forecaster

package
v0.0.0-...-6c9f6a5 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindClosest

func FindClosest(slice []*Weather, toFind int64) int

func GetAPIAddressFromEnv

func GetAPIAddressFromEnv() (string, error)

func GetAPIKeyFromEnv

func GetAPIKeyFromEnv() (string, error)

func IsNotFound

func IsNotFound(err error) bool

Types

type Forecast

type Forecast struct {
	Weathers             []*Weather `protobuf:"bytes,1,rep,name=weathers,proto3" json:"weathers,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_unrecognized     []byte     `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (*Forecast) Descriptor

func (*Forecast) Descriptor() ([]byte, []int)

func (*Forecast) GetWeathers

func (m *Forecast) GetWeathers() []*Weather

func (*Forecast) ProtoMessage

func (*Forecast) ProtoMessage()

func (*Forecast) Reset

func (m *Forecast) Reset()

func (*Forecast) String

func (m *Forecast) String() string

func (*Forecast) XXX_DiscardUnknown

func (m *Forecast) XXX_DiscardUnknown()

func (*Forecast) XXX_Marshal

func (m *Forecast) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Forecast) XXX_Merge

func (m *Forecast) XXX_Merge(src proto.Message)

func (*Forecast) XXX_Size

func (m *Forecast) XXX_Size() int

func (*Forecast) XXX_Unmarshal

func (m *Forecast) XXX_Unmarshal(b []byte) error

type Forecaster

type Forecaster interface {
	GetCurrentWeather(city string) (Weather, error)
	GetForecast(city string) ([]*Weather, error)
}

func WithCacheKeeper

func WithCacheKeeper(forecaster Forecaster, ck cache_keeper.CacheKeeper) Forecaster

type OWMForecaster

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

func NewOWM

func NewOWM(apiKey, apiAddress string) *OWMForecaster

func (*OWMForecaster) GetCurrentWeather

func (o *OWMForecaster) GetCurrentWeather(city string) (w Weather, err error)

func (*OWMForecaster) GetForecast

func (o *OWMForecaster) GetForecast(city string) (weathers []*Weather, err error)

type Weather

type Weather struct {
	Unit                 string   `protobuf:"bytes,1,opt,name=unit,proto3" json:"unit,omitempty"`
	Temperature          int32    `protobuf:"varint,2,opt,name=temperature,proto3" json:"temperature,omitempty"`
	Timestamp            int64    `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Weather) Descriptor

func (*Weather) Descriptor() ([]byte, []int)

func (*Weather) GetTemperature

func (m *Weather) GetTemperature() int32

func (*Weather) GetTimestamp

func (m *Weather) GetTimestamp() int64

func (*Weather) GetUnit

func (m *Weather) GetUnit() string

func (*Weather) ProtoMessage

func (*Weather) ProtoMessage()

func (*Weather) Reset

func (m *Weather) Reset()

func (*Weather) String

func (m *Weather) String() string

func (*Weather) XXX_DiscardUnknown

func (m *Weather) XXX_DiscardUnknown()

func (*Weather) XXX_Marshal

func (m *Weather) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Weather) XXX_Merge

func (m *Weather) XXX_Merge(src proto.Message)

func (*Weather) XXX_Size

func (m *Weather) XXX_Size() int

func (*Weather) XXX_Unmarshal

func (m *Weather) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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