Documentation ¶
Index ¶
- Constants
- func DumpResponse(r *colly.Response)
- func LastUpdated(r *colly.Response) (time.Time, error)
- func PrepareUrl(tpl string, args UrlArgs) string
- func RegisterMeasurable(name string, ctor NewMeasurable)
- type AirPressureMeasurement
- type BaseMeasurement
- type BoundingBox
- type CloudBaseMeasurement
- type Coordinate
- type CounterMeasurement
- type DewPointMeasurement
- type ErrorCallback
- type HumidityMeasurement
- type LuminosityMeasurement
- type Measurable
- type Measurement
- type MeasurementCallback
- type NO2Measurement
- type NewMeasurable
- type Object
- type OccupancyMeasurement
- type OccupancyPercentMeasurement
- type OzonMeasurement
- type PM10Measurement
- type Percent
- type RadiationMeasurement
- type RainMeasurement
- type SO2Measurement
- type SnowHeightMeasurement
- type SunshineHoursMeasurement
- type TemperatureMeasurment
- type UVIndexMeasurement
- type UrlArgs
- type WaitingTimeMeasurement
- type WindChillMeasurement
- type WindDirectionMeasurement
- type WindGustsMeasurement
- type WindSpeedMeasurement
Constants ¶
View Source
const (
EarthRadius = 6378100 // in meters
)
Variables ¶
This section is empty.
Functions ¶
func DumpResponse ¶
func DumpResponse(r *colly.Response)
func LastUpdated ¶
func PrepareUrl ¶
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 ¶
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 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 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"` }
Click to show internal directories.
Click to hide internal directories.