model

package
v0.0.0-...-83d12ba Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REarth                 = 6373.0
	LatitudeSecondInMeters = LatitudeMinuteInMeters / 60.0
	LatitudeMinuteInMeters = 1853.0
	LatitudeDegreeInMeters = LatitudeMinuteInMeters * 60.0
)
View Source
const (
	InfluxSF    = `` /* 186-byte string literal not displayed */
	InfluxAllSF = `` /* 157-byte string literal not displayed */
)
View Source
const (
	InfluxDDR = `` /* 196-byte string literal not displayed */
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DDR

type DDR interface {
	GetSF(lon LatLon) (string, error)
}

func NewDDR

func NewDDR(db Database, measurementName string, minRadius float64) DDR

type Database

type Database interface {
	Connect() error
	Write([]Metric) error
	Query(string) ([][]Metric, error)
	//QueryMeasurementWithGroupBy(string, string) ([][]Metric, error)
	//QueryMeasurementWithFilter(string, string) ([][]Metric, error)
	//QueryMeasurementWithMaxAge(string, string) ([][]Metric, error)
	//QueryMeasurementWithMaxAgeAndFilter(string, string, string) ([][]Metric, error)
	HasMetric(Metric, time.Time) bool
	Close() error
}

type GeoJSON

type GeoJSON interface {
	GetGeoJSONFromSF(string, string) (string, error)
	GetGeoJSONFromAllSF(string) (string, error)
}

func NewGeoJSON

func NewGeoJSON(db Database, measurementName string) GeoJSON

type LatLon

type LatLon struct {
	Latitude  float64
	Longitude float64
}

type Metric

type Metric interface {
	// Getting data structure functions
	Name() string
	Tags() map[string]string
	Fields() map[string]interface{}
	Time() time.Time

	// Tag functions
	HasTag(key string) bool
	AddTag(key, value string)
	RemoveTag(key string)

	// Field functions
	HasField(key string) bool
	AddField(key string, value interface{})
	RemoveField(key string) error
}

func NewMetric

func NewMetric(name string, tags map[string]string, fields map[string]interface{}, time time.Time) (Metric, error)

type Range

type Range struct {
	Start int
	End   int
}

func Join

func Join(r1, r2 *Range) *Range

func NewRangeFromEnd

func NewRangeFromEnd(end int) *Range

func NewRangeFromStart

func NewRangeFromStart(start int) *Range

func (Range) Overlaps

func (r Range) Overlaps(r2 *Range) bool

func (Range) Regex

func (r Range) Regex(precision int) string

Jump to

Keyboard shortcuts

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