All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
67 lines
1.2 KiB
Go
67 lines
1.2 KiB
Go
// forecast_queries.go contains SQL text for forecast reads.
|
|
// Layer: adapters/outbound/postgres forecast feature.
|
|
package postgres
|
|
|
|
const (
|
|
queryLatestHourlyForecast = `
|
|
SELECT
|
|
event_id,
|
|
location_id,
|
|
location_name,
|
|
issued_at,
|
|
updated_at,
|
|
product,
|
|
latitude,
|
|
longitude,
|
|
elevation_meters
|
|
FROM forecasts
|
|
WHERE product = 'hourly'
|
|
ORDER BY issued_at DESC, event_emitted_at DESC
|
|
LIMIT 1`
|
|
|
|
queryLatestNarrativeForecast = `
|
|
SELECT
|
|
event_id,
|
|
location_id,
|
|
location_name,
|
|
issued_at,
|
|
updated_at,
|
|
product,
|
|
latitude,
|
|
longitude,
|
|
elevation_meters
|
|
FROM forecasts
|
|
WHERE product = 'narrative'
|
|
ORDER BY issued_at DESC, event_emitted_at DESC
|
|
LIMIT 1`
|
|
|
|
queryForecastPeriods = `
|
|
SELECT
|
|
period_index,
|
|
start_time,
|
|
end_time,
|
|
name,
|
|
is_day,
|
|
condition_code,
|
|
text_description,
|
|
temperature_c,
|
|
temperature_c_min,
|
|
temperature_c_max,
|
|
dewpoint_c,
|
|
relative_humidity_percent,
|
|
wind_direction_degrees,
|
|
wind_speed_kmh,
|
|
wind_gust_kmh,
|
|
barometric_pressure_pa,
|
|
visibility_meters,
|
|
apparent_temperature_c,
|
|
cloud_cover_percent,
|
|
probability_of_precipitation_percent,
|
|
precipitation_amount_mm,
|
|
snowfall_depth_mm,
|
|
uv_index
|
|
FROM forecast_periods
|
|
WHERE run_event_id = $1
|
|
ORDER BY period_index ASC`
|
|
)
|