aqi

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentHTML

func CurrentHTML(current Current) html.HTML

Types

type API

type API interface {
	coordinates.GeoLocator
	Standard(Type) ([]AQI, error)
	Realtime(Type, string) (Current, error)
	Forecast(Type, string, int) ([]Day, error)
	History(Type, string, time.Time) (Day, error)
}

type AQI

type AQI interface {
	Type() Type
	Value() int
	Level() Level
}

func NewAQI

func NewAQI(typ Type, value int, level Level) AQI

type Current

type Current interface {
	Day
	Pollutants() []Pollutant
}

type Day

type Day interface {
	Date() string
	Unix() unit.UnixTime
	AQI() AQI
}

type Kind

type Kind int
const (
	CO Kind = iota + 1
	NO2
	O3
	PM2Dot5
	PM10
	SO2
)

func (Kind) HTML

func (k Kind) HTML() html.HTML

func (Kind) String

func (k Kind) String() string

type Level

type Level interface {
	String() string
	Color() string
}

func NewLevel

func NewLevel(lv, color string) Level

type Pollutant

type Pollutant interface {
	Kind() Kind
	Unit() string
	Value() float64
	Level() Level
}

func NewPollutant

func NewPollutant(kind Kind, unit string, value float64, level Level) Pollutant

type Type

type Type int
const (
	Australia Type = iota + 1
	Canada
	China
	Europe
	India
	Netherland
	UK
	US
)

func (Type) MarshalText

func (t Type) MarshalText() ([]byte, error)

func (Type) String

func (t Type) String() string

func (*Type) UnmarshalText

func (t *Type) UnmarshalText(b []byte) error

Jump to

Keyboard shortcuts

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