add support for barometric pressure

This commit is contained in:
2026-01-29 14:04:18 +11:00
parent 7a0081b2ed
commit 5d07c5d54b
9 changed files with 401 additions and 51 deletions

View File

@@ -122,3 +122,27 @@ func (d *DB) UpsertOpenMeteoHourly(ctx context.Context, p InsertOpenMeteoHourlyP
return err
}
type InsertBarometerParams struct {
TS time.Time
Site string
Source string
PressureHPA float64
Payload map[string]any
}
func (d *DB) InsertBarometer(ctx context.Context, p InsertBarometerParams) error {
b, _ := json.Marshal(p.Payload)
payloadJSON := json.RawMessage(b)
_, err := d.Pool.Exec(ctx, `
INSERT INTO observations_baro (
ts, site, source, pressure_hpa, payload_json
) VALUES (
$1,$2,$3,$4,$5
)
`, p.TS, p.Site, p.Source, p.PressureHPA, payloadJSON)
return err
}