domain

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const PNGContentType = ContentType("image/png")

Variables

This section is empty.

Functions

func IsErrNoSuchImage

func IsErrNoSuchImage(err error) bool

func IsErrNoSuchSubscription

func IsErrNoSuchSubscription(err error) bool

func IsErrNoSuchUser

func IsErrNoSuchUser(err error) bool

Types

type ContentType

type ContentType string

type Coordinates

type Coordinates struct {
	Latitude  float64
	Longitude float64
}

type ErrNoSuchImage

type ErrNoSuchImage struct {
	ID ImageID
}

func (ErrNoSuchImage) Error

func (e ErrNoSuchImage) Error() string

type ErrNoSuchSubscription

type ErrNoSuchSubscription struct {
	UserID         UserID
	SubscriptionID SubscriptionID
}

func (ErrNoSuchSubscription) Error

func (e ErrNoSuchSubscription) Error() string

type ErrNoSuchUser

type ErrNoSuchUser struct {
	ID UserID
}

func (ErrNoSuchUser) Error

func (e ErrNoSuchUser) Error() string

type Event

type Event struct {
	Time     time.Time
	Rainfall RainfallMilliMeterPerHour
}

type Forecast

type Forecast struct {
	Location      Location
	RainWillStart *Event
	RainWillStop  *Event
}

func NewForecast

func NewForecast(weather Weather) Forecast

func (*Forecast) HasAnyTopic

func (forecast *Forecast) HasAnyTopic() bool

type Image

type Image struct {
	ID          ImageID
	ContentType ContentType
	Bytes       []byte
	Time        time.Time
}

func NewPNGImage

func NewPNGImage(b []byte) Image

type ImageID

type ImageID string

type Location

type Location struct {
	Name        string
	Coordinates Coordinates
}

type RainfallMilliMeterPerHour

type RainfallMilliMeterPerHour float64

func (RainfallMilliMeterPerHour) String

func (r RainfallMilliMeterPerHour) String() string

type Recipient

type Recipient struct {
	SlackWebhookURL string
}

func (Recipient) IsZero

func (s Recipient) IsZero() bool

type Subscription

type Subscription struct {
	ID        SubscriptionID
	Location  Location
	Recipient Recipient
}

func NewSubscription

func NewSubscription(location Location) Subscription

func (Subscription) String

func (subscription Subscription) String() string

type SubscriptionID

type SubscriptionID string

type User

type User struct {
	ID            UserID
	YahooClientID YahooClientID
}

func NewUser

func NewUser() User

func (User) String

func (user User) String() string

type UserID

type UserID string

type Weather

type Weather struct {
	Location     Location
	Observations []Event
	Forecasts    []Event
}

func (Weather) FindRainStarts

func (w Weather) FindRainStarts() *Event

FindRainStarts returns the first event which it and next are non-zero.

func (Weather) FindRainStops

func (w Weather) FindRainStops() *Event

FindRainStops returns the first event which it and next are zero.

func (Weather) IsRainingNow

func (w Weather) IsRainingNow() bool

IsRainingNow returns true if the last observation is positive.

type YahooClientID

type YahooClientID string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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