Documentation ¶
Overview ¶
Pakiet openweather udostępnia funkcjonalność związaną z pobieraniem i drukowaniem danych pogodowych z serwisu http://openweathermap.org/. Umożliwia pobieranie aktualnej pogody i prognozy pogody na kilka dni (maksymalnie 16).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintForecast ¶
func PrintForecast(out io.Writer, forecast *ForecastResult) error
PrintForecast drukuje do out sformatowane dane pogodowe prognozy.
func PrintWeather ¶
func PrintWeather(out io.Writer, weather *WeatherResult) error
PrintWeather drukuje do out sformatowane dane pogodowe.
Types ¶
type DayWeather ¶
type DayWeather struct { Dt int64 Temp struct { Day float64 Min float64 Max float64 Night float64 Eve float64 Morn float64 } Pressure float64 Humidity float64 Weather []WeatherDescription Speed float64 Deg float64 Clouds float64 Rain float64 }
DayWeather jest elementem typu ForecastResult i zawiera dane prognozy pogody dla pojedynczego dnia.
type ForecastResult ¶
type ForecastResult struct { City struct { Id int Name string Coord struct { Lon float64 Lat float64 } Country string Population int } Cod string Message float64 Cnt int List []DayWeather }
ForecastResult representuje dane pogodowe prognozy.
func GetForecast ¶
func GetForecast(city string, days int) (*ForecastResult, error)
GetForecast pobiera z serwisu i zwraca prognozę pogody dla miasta city na days dni naprzód. Liczba dni days musi być z przedziału [1..17]. Zwraca ForecastResult i błąd jeśli wystąpił.
type WeatherDescription ¶
WeatherDescription jest elementem typów DayWeather i WeatherResult i zawiera słowny opis pogody.
type WeatherResult ¶
type WeatherResult struct { Coord struct { Lat float64 Lon float64 } Weather []WeatherDescription Base string Main struct { Temp float64 Pressure float64 Humidity float64 TempMin float64 `json:"temp_min"` TempMax float64 `json:"temp_max"` } Visibility int Wind struct { Speed float64 Deg float64 } Clouds struct { All float64 } Dt int64 Sys struct { Type int Id int Message float64 Country string Sunrise int64 Sunset int64 } Id int Name string Cod int }
WeatherResult representuje aktualne dane pogodowe.
func GetWeather ¶
func GetWeather(city string) (*WeatherResult, error)
GetWeather pobiera z serwisu i zwraca aktualne dane pogodowe dla miasta city. Zwraca WeatherResult i błąd jeśli wystąpił.