Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurrentWeatherData ¶
type CurrentWeatherData struct {
APIkey string
}
func (*CurrentWeatherData) GetByCityAndCountryCode ¶
func (c *CurrentWeatherData) GetByCityAndCountryCode(city, countryCode string) (weather *Weather, err error)
GetByCityAndCountryCode returns the current weather data by passing a city name and an ISO country code. It returns weather information or a detailed error For example, to query about Madrid, Spain you do:
currentWeather.GetByCityAndCountryCode("Madrid", "ES)
func (*CurrentWeatherData) GetByGeoCoordinates ¶
func (c *CurrentWeatherData) GetByGeoCoordinates(lat, lon float32) (weather *Weather, err error)
GetByGeoCoordinates returns the current weather data by passing a geographical coordinates (latitude and longitude) in decimal notation. It returns weather information or a detailed error. For example, to query about Madrid, Spain you do:
currentWeather.GetByGeoCoordinates(-3, 40)
type Weather ¶
type Weather struct {
Coord struct {
Lon float32 `json:"lon"`
Lat float32 `json:"lat"`
} `json:"coord"`
Weather []struct {
Id int `json:"id"`
Main string `json:"main"`
Description string `json:"description"`
Icon string `json:"icon"`
} `json:"weather"`
Base string `json:"base"`
Main struct {
Temp float32 `json:"temp"`
Pressure float32 `json:"pressure"`
Humidity float32 `json:"humidity"`
TempMin float32 `json:"temp_min"`
TempMax float32 `json:"temp_max"`
} `json:"main"`
Wind struct {
Speed float32 `json:"speed"`
Deg float32 `json:"deg"`
} `json:"wind"`
Clouds struct {
All int `json:"all"`
} `json:"clouds"`
Rain struct {
ThreeHours float32 `json:"3h"`
} `json:"rain"`
Dt uint32 `json:"dt"`
Sys struct {
Type int `json:"type"`
ID int `json:"id"`
Message float32 `json:"message"`
Country string `json:"country"`
Sunrise int `json:"sunrise"`
Sunset int `json:"sunset"`
} `json:"sys"`
ID int `json:"id"`
Name string `json:"name"`
Cod int `json:"cod"`
}
Click to show internal directories.
Click to hide internal directories.