Documentation ¶
Index ¶
- func MakeURL(cityID, units, apiID string) (string, error)
- type WeatherData
- func (w *WeatherData) GetCloudCoverage() int
- func (w *WeatherData) GetCoords() string
- func (w *WeatherData) GetData(url string) error
- func (w *WeatherData) GetFeelsLike() float32
- func (w *WeatherData) GetHumidity() int
- func (w *WeatherData) GetMaxTemp() int
- func (w *WeatherData) GetMinTemp() float32
- func (w *WeatherData) GetPressure() int
- func (w *WeatherData) GetTemp() float32
- func (w *WeatherData) GetVisibility() int
- func (w *WeatherData) GetWindSpeed() float32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type WeatherData ¶
type WeatherData 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"` FeelsLike float32 `json:"feels_like"` TempMin float32 `json:"temp_min"` TempMax int `json:"temp_max"` Pressure int `json:"pressure"` Humidity int `json:"humidity"` } `json:"main"` Visibility int `json:"visibility"` Wind struct { Speed float32 `json:"speed"` Deg int `json:"deg"` } `json:"wind"` Clouds struct { All int `json:"all"` } `json:"clouds"` Dt int `json:"dt"` Sys struct { Type int `json:"type"` ID int `json:"id"` Country string `json:"country"` Sunrise int `json:"sunrise"` Sunset int `json:"sunset"` } `json:"sys"` Timezone int `json:"timezone"` ID int `json:"id"` Name string `json:"name"` Cod int `json:"cod"` }
WeatherData holds the information passed back from the OpenWeather API
func (*WeatherData) GetCloudCoverage ¶
func (w *WeatherData) GetCloudCoverage() int
GetCloudCoverage returns an int as a percentage of cloud coverage
func (*WeatherData) GetCoords ¶
func (w *WeatherData) GetCoords() string
GetCoords returns a string of "lat, long"
func (*WeatherData) GetData ¶
func (w *WeatherData) GetData(url string) error
GetData calls the OpenWeatherMap API and adds the date to the struct.
func (*WeatherData) GetFeelsLike ¶
func (w *WeatherData) GetFeelsLike() float32
GetFeelsLike returns the current "feels like" temperature that GetData gets in the call.
func (*WeatherData) GetHumidity ¶
func (w *WeatherData) GetHumidity() int
GetHumidity returns the current humidity (as a percentage) that GetData gets in the call.
func (*WeatherData) GetMaxTemp ¶
func (w *WeatherData) GetMaxTemp() int
GetMaxTemp returns the current high temperature that GetData gets in the call.
func (*WeatherData) GetMinTemp ¶
func (w *WeatherData) GetMinTemp() float32
GetMinTemp returns the current high temperature that GetData gets in the call.
func (*WeatherData) GetPressure ¶
func (w *WeatherData) GetPressure() int
GetPressure returns the current pressure that GetData gets in the call.
func (*WeatherData) GetTemp ¶
func (w *WeatherData) GetTemp() float32
GetTemp returns the current temperature that GetData gets in the call.
func (*WeatherData) GetVisibility ¶
func (w *WeatherData) GetVisibility() int
GetVisibility returns a visiblity meter integer
func (*WeatherData) GetWindSpeed ¶
func (w *WeatherData) GetWindSpeed() float32
GetWindSpeed returns the current windspeed of the city.