Documentation ¶
Overview ¶
Package weather fetches weather data
Index ¶
Constants ¶
This section is empty.
Variables ¶
var OpenWeatherMapProvider provider = "OpenWeatherMap"
OpenWeatherMapProvider is a weather provider
Functions ¶
This section is empty.
Types ¶
type Description ¶
type Description string
Description is a standardized weather description
const Clear Description = "Clear"
Clear indicates clear skies
const Extreme Description = "Extreme"
Extreme indicates an extreme event
const LightClouds Description = "Light Clouds"
LightClouds indicate some clouds
const OvercastClouds Description = "Overcast"
OvercastClouds indicates heavy clouds
const Rain Description = "Rain"
Rain indicates rain
const ScatteredClouds Description = "Scattered Clouds"
ScatteredClouds indicates scattered clouds
const Snow Description = "Snow"
Snow indicates snow
const ThunderStorm Description = "Thunderstorm"
ThunderStorm indicates a thunderstorm
const Windy Description = "Windy"
Windy indicates winds
type Fetcher ¶
type Fetcher interface { FetchByCity(city string) (*Weather, error) FetchByLatLong(lat, long float64, timeZone string) (*Weather, error) FetchByZip(zip int) (*Weather, error) }
Fetcher retrieves the current and forecasted weather How to get the timezone of a zipcode? http://download.geonames.org/export/zip/? gives lat/long of a zipcode then https://stackoverflow.com/a/16086964/522962 for the timezone.
type Instant ¶
type Instant struct { Date time.Time Code Description Temperature int Low int High int Wind float64 Clouds float64 Rain float64 Snow float64 Pressure float64 Humidity float64 }
Instant is the weather for a specified time
type OpenWeatherMap ¶
OpenWeatherMap retrieves information from the OpenWeatherMap API
func (*OpenWeatherMap) FetchByCity ¶
func (o *OpenWeatherMap) FetchByCity(city string) (*Weather, error)
FetchByCity retrieves weather for a city from the OpenWeatherMap api
func (*OpenWeatherMap) FetchByLatLong ¶
func (o *OpenWeatherMap) FetchByLatLong(lat, long float64, timeZone string) (*Weather, error)
FetchByLatLong retrieves weather for a latitude/longitude location from the OpenWeatherMap api
func (*OpenWeatherMap) FetchByZip ¶
func (o *OpenWeatherMap) FetchByZip(zip int) (*Weather, error)
FetchByZip retrieves weather for a zipcode from the OpenWeatherMap api
type OwmInstant ¶
type OwmInstant struct { Instant *Instant Dt int64 `json:"dt"` Main struct { Temp float64 `json:"temp"` TempMin float64 `json:"temp_min"` TempMax float64 `json:"temp_max"` Pressure float64 `json:"pressure"` Humidity int `json:"humidity"` SeaLevel float64 `json:"sea_level"` GrndLevel float64 `json:"grnd_level"` TempKf float64 `json:"temp_kf"` } `json:"main"` Weather []struct { ID int `json:"id"` Main string `json:"main"` Description string `json:"description"` Icon string `json:"icon"` } `json:"weather"` Wind struct { Speed float64 `json:"speed"` Deg float64 `json:"deg"` } `json:"wind"` Clouds struct { All int `json:"all"` } `json:"clouds"` Rain struct { All float64 `json:"3h"` // rain volume for last 3 hrs } `json:"rain"` Snow struct { All float64 `json:"3h"` // snow volume for last 3 hrs } `json:"snow"` Sys struct { Type int `json:"type"` ID int `json:"id"` Message float64 `json:"message"` Pod string `json:"pod"` Country string `json:"country"` Sunrise int `json:"sunrise"` Sunset int `json:"sunset"` } `json:"sys"` }
OwmInstant is an OpenWeatherMap day