weather

package
v0.0.0-...-26aeaf7 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

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

Set of error variables for CRUD operations.

Functions

This section is empty.

Types

type City

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

City is used to capture the city id in relationships.

type Info

type Info 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"`
}

Info contains the weather data points captured from the API.

type Weather

type Weather struct {
	// contains filtered or unexported fields
}

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

func New

func New(log *log.Logger, gql *graphql.GraphQL) Weather

New constructs a Weather for api access.

func (Weather) QueryByCity

func (w Weather) QueryByCity(ctx context.Context, traceID string, cityID string) (Info, error)

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

func (Weather) Replace

func (w Weather) Replace(ctx context.Context, traceID string, wth Info) (Info, error)

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

Jump to

Keyboard shortcuts

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