stats

package
v0.0.0-...-91e38f7 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAirplanes

func GetAirplanes(ctx context.Context, cfg *Config) (float64, error)

GetAirplanes gets the number of airplanes we can see.

func GetAssetMix

func GetAssetMix(ctx context.Context) (float64, error)

GetAssetMix gets our asset mix from LunchMoney. TODO: Add to config thing.

func GetBTCPrice

func GetBTCPrice(ctx context.Context, cfg *Config) (float64, error)

GetBTCPrice gets the price of BTC in USD.

func GetChiaPrice

func GetChiaPrice(ctx context.Context, cfg *Config) (float64, error)

GetChiaPrice gets the price of XCH in USD.

func GetCounts

func GetCounts(ctx context.Context, cfg *Config) ([]*gql.Stat, error)

GetCounts gets counts from graphql.

func GetCryptoPrice

func GetCryptoPrice(ctx context.Context, crypto string) (float64, error)

GetCryptoPrice gets a crypto in USD from coinbase.

func GetETHPrice

func GetETHPrice(ctx context.Context, cfg *Config) (float64, error)

GetETHPrice gets the price of eth in USD.

Types

type Aircraft

type Aircraft struct {
	AltBaro        FlexInt       `json:"alt_baro,omitempty"`
	AltGeom        int           `json:"alt_geom,omitempty"`
	BaroRate       int           `json:"baro_rate,omitempty"`
	Category       string        `json:"category,omitempty"`
	Emergency      string        `json:"emergency,omitempty"`
	Flight         string        `json:"flight,omitempty"`
	GeomRate       int           `json:"geom_rate,omitempty"`
	Gs             float64       `json:"gs,omitempty"`
	Gva            int           `json:"gva,omitempty"`
	Hex            string        `json:"hex"`
	Lat            float64       `json:"lat,omitempty"`
	Lon            float64       `json:"lon,omitempty"`
	Messages       int           `json:"messages"`
	Mlat           []interface{} `json:"mlat"`
	NacP           int           `json:"nac_p,omitempty"`
	NacV           int           `json:"nac_v,omitempty"`
	NavAltitudeMcp int           `json:"nav_altitude_mcp,omitempty"`
	NavHeading     float64       `json:"nav_heading,omitempty"`
	NavModes       []string      `json:"nav_modes,omitempty"`
	NavQnh         float64       `json:"nav_qnh,omitempty"`
	Nic            int           `json:"nic,omitempty"`
	NicBaro        int           `json:"nic_baro,omitempty"`
	Rc             int           `json:"rc,omitempty"`
	Rssi           float64       `json:"rssi"`
	Sda            int           `json:"sda,omitempty"`
	Seen           float64       `json:"seen"`
	SeenPos        float64       `json:"seen_pos,omitempty"`
	Sil            int           `json:"sil,omitempty"`
	SilType        string        `json:"sil_type,omitempty"`
	Squawk         string        `json:"squawk,omitempty"`
	Tisb           []interface{} `json:"tisb"`
	Track          float64       `json:"track,omitempty"`
	Type           string        `json:"type,omitempty"`
	Version        int           `json:"version,omitempty"`
}

Aircraft is a ADS-B aircraft data type.

type Config

type Config struct {
	shared.Config

	GraphQLToken string
	OWMKey       string
}

Config stores config.

func (*Config) UpdateOften

func (c *Config) UpdateOften(ctx context.Context) error

UpdateOften updates stats that can be fetched quickly.

func (*Config) UpdateRarely

func (c *Config) UpdateRarely(ctx context.Context) error

UpdateRarely updates stats that should be fetched less frequently.

func (*Config) UploadStat

func (c *Config) UploadStat(ctx context.Context, key string, value float64) error

UploadStat uploads a single stat.

type FlexInt

type FlexInt int

FlexInt is an int that can be parsed for json, and if the json is a string, is set to 0.

func (*FlexInt) UnmarshalJSON

func (fi *FlexInt) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface, which allows us to ingest values of any json type as an int and run our custom conversion

type KeyFunc

type KeyFunc func(context.Context, *Config) (float64, error)

KeyFunc is a function for key exporters.

func GetCurrentWeather

func GetCurrentWeather(location string) KeyFunc

GetCurrentWeather gets the weather for a place from OWM.

Jump to

Keyboard shortcuts

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