Made forecast-period conditionCode optional
All checks were successful
ci/woodpecker/manual/build-image Pipeline was successful

This commit is contained in:
2026-05-28 07:47:07 -05:00
parent f457bab039
commit cca873cafb
10 changed files with 54 additions and 19 deletions

View File

@@ -137,7 +137,7 @@ func mapForecastEvent(e fkevent.Event) ([]fksinks.PostgresWrite, error) {
"end_time": p.EndTime.UTC(),
"name": nullableString(p.Name),
"is_day": nullableBool(p.IsDay),
"condition_code": int(p.ConditionCode),
"condition_code": nullableWMOCode(p.ConditionCode),
"text_description": nullableString(p.TextDescription),
"temperature_c": nullableFloat64(p.TemperatureC),
"temperature_c_min": nullableFloat64(p.TemperatureCMin),
@@ -370,6 +370,13 @@ func nullableTime(v *time.Time) any {
return v.UTC()
}
func nullableWMOCode(v *model.WMOCode) any {
if v == nil {
return nil
}
return int(*v)
}
func compactJSONText(v any) (any, error) {
if v == nil {
return nil, nil