Documentation
¶
Index ¶
- Constants
- Variables
- func NewAggregate(aqlBody string) (*aggregate, error)
- func NewApply(aqlBody string) (*apply, error)
- func NewLookup(aqlBody string) (*lookup, error)
- func Parse(s string) (engine.SequenceableTransform, error)
- type Aggregate
- type AggregateTerm
- type Apply
- type ArgumentMap
- type CastColumn
- type CastFn
- type Column
- type ConversionColumn
- type FunctionApplication
- type FunctionArgument
- type JoinCondition
- type Lookup
- type LookupColumn
- type Reducer
- type Timeseries
- type TimeseriesItem
Constants ¶
const (
DefaultDatabaseDateFormat = "YYYY-MM-DDTHH:MM:SSZ"
)
const (
NoGroupBy = ""
)
Variables ¶
var ErrTimeseriesNoEarlierData = errors.New("could not trim timeseries because its start time is later than the requested start time")
ErrTimeseriesNoEarlierData is returned when trimming or resampling a timeseries when the desired start time is later than the earliest point in the timeseries.
Functions ¶
func Parse ¶
func Parse(s string) (engine.SequenceableTransform, error)
Parse parses and initializes a transform given its body and input sequence.
Types ¶
type Aggregate ¶
type Aggregate struct {
Select []AggregateTerm `"AGGREGATE " @@ { "," @@ }`
GroupBy []string `["GROUP " "BY " @Ident { "," @Ident}]`
}
type AggregateTerm ¶
type AggregateTerm struct {
Column string `(@Ident`
Function *FunctionApplication `| @@)`
Alias string `["AS " @Ident]`
}
type Apply ¶
type Apply struct {
Projections []ConversionColumn `"APPLY " @@ {"," @@}`
}
type ArgumentMap ¶
type ArgumentMap func(args []interface{}) []interface{}
ArgumentMap is used to map the incoming engine.Message into a slice of interface that is correct for a Reducer.Reduce() method.
var ( Reducers = map[string]Reducer{"cdf(": &cdf{}, "quantile(": &quantile{}, "count(": &count{}, "sum(": &sum{}, "min(": &min{}, "max(": &max{}, "avg(": &avg{}, "zoh(": &zoh{}} DefaultArgMap ArgumentMap = func(i []interface{}) []interface{} { return i } )
The reason that Function's have to include the opening ( is because we can't parse these as Ident due the issue in https://github.com/alecthomas/participle/issues/3
type CastColumn ¶
type CastFn ¶
type CastFn func(src interface{}) (interface{}, error)
CastFn casts a source interface into a destination interface. A nil interface maps to a nil interface regardless of the destination type.
type ConversionColumn ¶
type ConversionColumn struct {
Lookup *Column `@@`
Cast *CastColumn `| @@`
}
type FunctionApplication ¶
type FunctionApplication struct {
Function string `@Function`
Columns []FunctionArgument `@@ { "," @@ } ")"`
}
type FunctionArgument ¶
type JoinCondition ¶
type JoinCondition struct {
T1Column *LookupColumn `@@`
T2Column *LookupColumn `"=" @@`
}
type Lookup ¶
type Lookup struct {
Projection []LookupColumn `"LOOKUP " @@ {"," @@}`
FromSource string `"FROM " @Ident`
InnerJoin bool `(@"INNER "`
OuterJoin bool `| @"OUTER ")`
LookupSource string `"JOIN " @Ident`
Conditions []JoinCondition `"ON " @@ { "AND " @@}`
}
type LookupColumn ¶
type Reducer ¶
type Reducer interface {
ParameterLen() int //ParameterLen returns the number of parameters the function takes (should be constant)
SetArgumentMap(ArgumentMap)
Reduce(arg []interface{}) error
Copy() Reducer //Returns a reducer with blank state
Return() *float64
}
type Timeseries ¶
type Timeseries []TimeseriesItem
Timeseries represents a data point changing in time. It is assumed to be ordered by Time, ascending.
func (Timeseries) Equals ¶
func (t Timeseries) Equals(w interface{}) bool
Equals check for equality with "something". This is to make Timeseries satisfy the Value interface.
func (Timeseries) Len ¶
func (t Timeseries) Len() int
func (Timeseries) Less ¶
func (t Timeseries) Less(i, j int) bool
func (Timeseries) Mean ¶
Mean computes the ZOH average of the timeseries between `start` and `end`. It returns NaN if start is before the earliest point of the timeseries or if `end` is not after `start`.
func (Timeseries) Start ¶
func (t Timeseries) Start() *time.Time
Start returns the first time where the series is defined.
func (Timeseries) Swap ¶
func (t Timeseries) Swap(i, j int)
type TimeseriesItem ¶
TimeseriesItem is a point in a timeseries
func (TimeseriesItem) Equals ¶
func (ti TimeseriesItem) Equals(w interface{}) bool
Equals checks for equality with "something". This is to make TimeseriesItem satisfy the Value interface.
Source Files
¶
- aggregate.go
- apply.go
- avg.go
- cast.go
- cdf.go
- common.go
- count.go
- lookup.go
- max.go
- min.go
- quantile.go
- sum.go
- transforms.go
- zoh.go