Version: v0.0.0-...-b472bfd Latest Latest

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 6 Imported by: 0



Package weather provides support for managing weather data in the database.



This section is empty.


View Source
var (
	ErrNotFound = errors.New("weather not found")

Set of error variables for CRUD operations.


This section is empty.


type City

type City struct {
	ID string `json:"id"`

City is used to capture the city id in relationships.

type Store

type Store struct {
	// contains filtered or unexported fields

Store manages the set of API's for city access.

func NewStore

func NewStore(log *log.Logger, gql *graphql.GraphQL) Store

NewStore constructs a weather store for api access.

func (Store) QueryByCity

func (s Store) QueryByCity(ctx context.Context, traceID string, cityID string) (Weather, error)

QueryByCity returns the specified weather from the database by the city id.

func (Store) Replace

func (s Store) Replace(ctx context.Context, traceID string, wth Weather) (Weather, error)

Replace replaces a weather in the database and connects it to the specified city.

type Weather

type Weather struct {
	ID            string  `json:"id,omitempty"`
	City          City    `json:"city"`
	CityName      string  `json:"city_name"`
	Visibility    string  `json:"visibility"`
	Desc          string  `json:"description"`
	Temp          float64 `json:"temp"`
	FeelsLike     float64 `json:"feels_like"`
	MinTemp       float64 `json:"temp_min"`
	MaxTemp       float64 `json:"temp_max"`
	Pressure      int     `json:"pressure"`
	Humidity      int     `json:"humidity"`
	WindSpeed     float64 `json:"wind_speed"`
	WindDirection int     `json:"wind_direction"`
	Sunrise       int     `json:"sunrise"`
	Sunset        int     `json:"sunset"`

Weather contains the weather data points captured from the API.

Jump to

Keyboard shortcuts

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