Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddWeatherLocation ¶
func AddWeatherLocation(ctx context.Context, location config.WeatherLocation)
AddWeatherLocation adds a new weather location to be monitored. It takes a context.Context for cancellation and a config.WeatherLocation struct to configure the monitoring. The weather data is fetched immediately and then updated every 10 minutes until the context is cancelled. If the location is marked as default and no default exists yet, it will be set as the default location.
func DefaultLocation ¶
func DefaultLocation() string
func SetDefaultLocation ¶
func SetDefaultLocation(location string)
Types ¶
type Weather ¶
type Weather struct { Coord Coord `json:"coord"` Data []WeatherData `json:"weather"` Base string `json:"base"` Main Main `json:"main"` Visibility int `json:"visibility"` Wind Wind `json:"wind"` Clouds Clouds `json:"clouds"` Dt int `json:"dt"` Sys Sys `json:"sys"` Timezone int `json:"timezone"` ID int `json:"id"` Name string `json:"name"` Cod int `json:"cod"` }
type WeatherData ¶
type WeatherLocation ¶
type WeatherLocation struct { Name string Lat string Lon string API string Unit string Lang string Weather }
func CurrentWeather ¶
func CurrentWeather(name string) WeatherLocation
CurrentWeather retrieves the current weather data for a given location name. Returns a WeatherLocation struct containing the weather data, or an empty struct if not found.
Click to show internal directories.
Click to hide internal directories.