Documentation ¶
Index ¶
- func FindClosest(slice []*Weather, toFind int64) int
- func GetAPIAddressFromEnv() (string, error)
- func GetAPIKeyFromEnv() (string, error)
- func IsNotFound(err error) bool
- type Forecast
- func (*Forecast) Descriptor() ([]byte, []int)
- func (m *Forecast) GetWeathers() []*Weather
- func (*Forecast) ProtoMessage()
- func (m *Forecast) Reset()
- func (m *Forecast) String() string
- func (m *Forecast) XXX_DiscardUnknown()
- func (m *Forecast) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Forecast) XXX_Merge(src proto.Message)
- func (m *Forecast) XXX_Size() int
- func (m *Forecast) XXX_Unmarshal(b []byte) error
- type Forecaster
- type OWMForecaster
- type Weather
- func (*Weather) Descriptor() ([]byte, []int)
- func (m *Weather) GetTemperature() int32
- func (m *Weather) GetTimestamp() int64
- func (m *Weather) GetUnit() string
- func (*Weather) ProtoMessage()
- func (m *Weather) Reset()
- func (m *Weather) String() string
- func (m *Weather) XXX_DiscardUnknown()
- func (m *Weather) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Weather) XXX_Merge(src proto.Message)
- func (m *Weather) XXX_Size() int
- func (m *Weather) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindClosest ¶
func GetAPIAddressFromEnv ¶
func GetAPIKeyFromEnv ¶
func IsNotFound ¶
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) GetWeathers ¶
func (*Forecast) ProtoMessage ¶
func (*Forecast) ProtoMessage()
func (*Forecast) XXX_DiscardUnknown ¶
func (m *Forecast) XXX_DiscardUnknown()
func (*Forecast) XXX_Marshal ¶
func (*Forecast) XXX_Unmarshal ¶
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) GetTemperature ¶
func (*Weather) GetTimestamp ¶
func (*Weather) ProtoMessage ¶
func (*Weather) ProtoMessage()
func (*Weather) XXX_DiscardUnknown ¶
func (m *Weather) XXX_DiscardUnknown()
func (*Weather) XXX_Marshal ¶
func (*Weather) XXX_Unmarshal ¶
Click to show internal directories.
Click to hide internal directories.