cfac

package
v0.0.0-...-441f3cd Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EarthRadius = 6378100 // in meters
)

Variables

This section is empty.

Functions

func DumpResponse

func DumpResponse(r *colly.Response)

func LastUpdated

func LastUpdated(r *colly.Response) (time.Time, error)

func PrepareUrl

func PrepareUrl(tpl string, args UrlArgs) string

func RegisterMeasurable

func RegisterMeasurable(name string, ctor NewMeasurable)

Types

type AirPressureMeasurement

type AirPressureMeasurement struct {
	BaseMeasurement

	AirPressure float64 `json:"air_pressure"`
}

type BaseMeasurement

type BaseMeasurement struct {
	Name   string `json:"name,omitempty"`
	Time   uint64 `json:"time"`
	Metric string `json:"metric,omitempty"`
	Source string `json:"source,omitempty"`

	Object *Object `json:"object,omitempty"`

	Tags map[string]string `json:"tag,omitempty"`
}

func (BaseMeasurement) WithTags

func (b BaseMeasurement) WithTags(kv ...string) BaseMeasurement

func (BaseMeasurement) WithUnit

func (b BaseMeasurement) WithUnit(unit string) BaseMeasurement

type BoundingBox

type BoundingBox struct {
	NorthWest Coordinate `json:"nw"`
	SouthEast Coordinate `json:"se"`
}

type CloudBaseMeasurement

type CloudBaseMeasurement struct {
	BaseMeasurement

	CloudBase float64 `json:"cloud_base"`
}

type Coordinate

type Coordinate struct {
	Latitude  float64 `json:"lat"`
	Longitude float64 `json:"lon"`
}

func (Coordinate) DistanceTo

func (c Coordinate) DistanceTo(to Coordinate) float64

Distance function returns the distance (in meters) between two points of

a given longitude and latitude relatively accurately (using a spherical
approximation of the Earth) through the Haversin Distance Formula for
great arc distance on a sphere with accuracy for small distances

point coordinates are supplied in degrees and converted into rad. in the func

distance returned is METERS!!!!!! http://en.wikipedia.org/wiki/Haversine_formula

type CounterMeasurement

type CounterMeasurement struct {
	BaseMeasurement

	Count uint64 `json:"count"`
}

type DewPointMeasurement

type DewPointMeasurement struct {
	BaseMeasurement

	DewPoint float64 `json:"dew_point"`
}

type ErrorCallback

type ErrorCallback func(error)

type HumidityMeasurement

type HumidityMeasurement struct {
	BaseMeasurement

	Humidity float64 `json:"humidity"`
}

type LuminosityMeasurement

type LuminosityMeasurement struct {
	BaseMeasurement

	Luminosity float64 `json:"luminosity"`
}

type Measurable

type Measurable interface {
	Fetch(c *colly.Collector, cb MeasurementCallback, ecb ErrorCallback) *sync.WaitGroup
}

type Measurement

type Measurement interface{}

type MeasurementCallback

type MeasurementCallback func(m Measurement)

type NO2Measurement

type NO2Measurement struct {
	BaseMeasurement

	NO2 float64 `json:"no2"`
}

type NewMeasurable

type NewMeasurable func() Measurable

func GetMeasurable

func GetMeasurable(name string) (NewMeasurable, error)

type Object

type Object struct {
	Name     string      `json:"name"`
	Location *Coordinate `json:"location,omitempty"`
}

type OccupancyMeasurement

type OccupancyMeasurement struct {
	BaseMeasurement

	Occupancy float64 `json:"occupancy"`
	Capacity  float64 `json:"capacity,omitempty"`
}

type OccupancyPercentMeasurement

type OccupancyPercentMeasurement struct {
	BaseMeasurement

	Occupancy Percent `json:"occupancy_percent"`
}

type OzonMeasurement

type OzonMeasurement struct {
	BaseMeasurement

	Ozon float64 `json:"ozon"`
}

type PM10Measurement

type PM10Measurement struct {
	BaseMeasurement

	PM10 float64 `json:"pm10"`
}

type Percent

type Percent int

type RadiationMeasurement

type RadiationMeasurement struct {
	BaseMeasurement

	Radiation float64 `json:"radiation"`
}

type RainMeasurement

type RainMeasurement struct {
	BaseMeasurement

	Rain float64 `json:"rain"`
}

type SO2Measurement

type SO2Measurement struct {
	BaseMeasurement

	SO2 float64 `json:"so2"`
}

type SnowHeightMeasurement

type SnowHeightMeasurement struct {
	BaseMeasurement

	SnowHeight float64 `json:"snow_height"`
}

type SunshineHoursMeasurement

type SunshineHoursMeasurement struct {
	BaseMeasurement

	SunshineHours float64 `json:"sunshine_hours"`
}

type TemperatureMeasurment

type TemperatureMeasurment struct {
	BaseMeasurement

	Temperature float64 `json:"temperature"`
}

type UVIndexMeasurement

type UVIndexMeasurement struct {
	BaseMeasurement

	UVIndex float64 `json:"uv_index"`
}

type UrlArgs

type UrlArgs map[string]interface{}

type WaitingTimeMeasurement

type WaitingTimeMeasurement struct {
	BaseMeasurement

	WaitingTime  int `json:"waiting_time"`
	VisitorCount int `json:"visitor_count"`
}

type WindChillMeasurement

type WindChillMeasurement struct {
	BaseMeasurement

	WindChill float64 `json:"wind_chill"`
}

type WindDirectionMeasurement

type WindDirectionMeasurement struct {
	BaseMeasurement

	WindDirection float64 `json:"wind_direction"`
}

type WindGustsMeasurement

type WindGustsMeasurement struct {
	BaseMeasurement

	WindGusts float64 `json:"wind_gusts"`
}

type WindSpeedMeasurement

type WindSpeedMeasurement struct {
	BaseMeasurement

	WindSpeed float64 `json:"wind_speed"`
}

Jump to

Keyboard shortcuts

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