Files
weatherapi/internal/adapters/outbound/postgres/alerts_queries.go
Eric Rakestraw 2a33fe01cf
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
Update to support upstream weatherfeeder v0.12.1 and add ends field to the alerts schema
2026-06-16 20:08:03 -05:00

55 lines
831 B
Go

// alerts_queries.go contains SQL text for alert-run reads.
// Layer: adapters/outbound/postgres alerts feature.
package postgres
const (
queryLatestAlertRun = `
SELECT
event_id,
location_id,
location_name,
as_of,
latitude,
longitude
FROM alert_runs
ORDER BY as_of DESC, event_emitted_at DESC
LIMIT 1`
queryAlerts = `
SELECT
alert_index,
alert_id,
event,
headline,
severity,
urgency,
certainty,
status,
message_type,
category,
response,
description,
instruction,
sent,
effective,
onset,
ends,
expires,
area_description,
sender_name
FROM alerts
WHERE run_event_id = $1
ORDER BY alert_index ASC`
queryAlertReferences = `
SELECT
alert_index,
id,
identifier,
sender,
sent
FROM alert_references
WHERE run_event_id = $1
ORDER BY alert_index ASC, reference_index ASC`
)