34 lines
713 B
Go
34 lines
713 B
Go
// observations_queries.go contains SQL text for observation reads.
|
|
// Layer: adapters/outbound/postgres observations feature.
|
|
package postgres
|
|
|
|
const (
|
|
queryLatestObservation = `
|
|
SELECT
|
|
event_id,
|
|
station_id,
|
|
station_name,
|
|
observed_at,
|
|
condition_code,
|
|
is_day,
|
|
text_description,
|
|
temperature_c,
|
|
dewpoint_c,
|
|
wind_direction_degrees,
|
|
wind_speed_kmh,
|
|
wind_gust_kmh,
|
|
barometric_pressure_pa,
|
|
visibility_meters,
|
|
relative_humidity_percent,
|
|
apparent_temperature_c
|
|
FROM observations
|
|
ORDER BY observed_at DESC, event_emitted_at DESC
|
|
LIMIT 1`
|
|
|
|
queryObservationPresentWeather = `
|
|
SELECT weather_index, raw_text
|
|
FROM observation_present_weather
|
|
WHERE event_id = $1
|
|
ORDER BY weather_index ASC`
|
|
)
|