Version: v0.0.0-...-ed10462 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 7 Imported by: 5



Package openweathermap provides weather using the OpenWeatherMap API, available at



This section is empty.


This section is empty.


This section is empty.


type Config

type Config string

Config represents open weather map API configuration (just the API key) from which a weather.Provider can be built.

func New

func New(apiKey string) Config

New creates a new OpenWeatherMap API configuration.

func (Config) CityID

func (c Config) CityID(cityID string) weather.Provider

CityID queries OWM by city id. Recommended.

func (Config) CityName

func (c Config) CityName(city, country string) weather.Provider

CityName queries OWM using a named city. Least accurate.

func (Config) Coords

func (c Config) Coords(lat, lon float64) weather.Provider

Coords queries OWM using lat/lon co-ordinates.

func (Config) Zipcode

func (c Config) Zipcode(zip, country string) weather.Provider

Zipcode queries OWM using a zip code or post code and country.

type Provider

type Provider string

Provider wraps an open weather map API url so that it can be used as a weather.Provider.

func (Provider) GetWeather

func (owm Provider) GetWeather() (weather.Weather, error)

GetWeather gets weather information from OpenWeatherMap.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL