Documentation ¶
Index ¶
- func Avg(fv *Float64Field) *float64
- func Count(fv *Float64Field) *float64
- func GetSupportedReduceFuncs() []string
- func Last(fv *Float64Field) *float64
- func Max(fv *Float64Field) *float64
- func Min(fv *Float64Field) *float64
- func Sum(fv *Float64Field) *float64
- type DropNonNumber
- type Expr
- type Float64Field
- type NoData
- func (s NoData) AddNotice(notice data.Notice)
- func (s NoData) AsDataFrame() *data.Frame
- func (s NoData) GetLabels() data.Labels
- func (s NoData) GetMeta() interface{}
- func (s NoData) New() NoData
- func (s NoData) SetLabels(ls data.Labels)
- func (s NoData) SetMeta(v interface{})
- func (s NoData) Type() parse.ReturnType
- func (s NoData) Value() interface{}
- type Number
- func (n Number) AddNotice(notice data.Notice)
- func (n Number) AsDataFrame() *data.Frame
- func (n Number) GetFloat64Value() *float64
- func (n Number) GetLabels() data.Labels
- func (n Number) GetMeta() interface{}
- func (n Number) SetLabels(ls data.Labels)
- func (n Number) SetMeta(v interface{})
- func (n Number) SetValue(f *float64)
- func (n Number) Type() parse.ReturnType
- func (n Number) Value() interface{}
- type ReduceMapper
- type ReducerFunc
- type ReplaceNonNumberWithValue
- type Results
- type Scalar
- func (s Scalar) AddNotice(notice data.Notice)
- func (s Scalar) AsDataFrame() *data.Frame
- func (s Scalar) GetFloat64Value() *float64
- func (s Scalar) GetLabels() data.Labels
- func (s Scalar) GetMeta() interface{}
- func (s Scalar) SetLabels(ls data.Labels)
- func (s Scalar) SetMeta(v interface{})
- func (s Scalar) Type() parse.ReturnType
- func (s Scalar) Value() interface{}
- type Series
- func (s Series) AddNotice(notice data.Notice)
- func (s Series) AppendPoint(t time.Time, f *float64)
- func (s Series) AsDataFrame() *data.Frame
- func (s Series) GetLabels() data.Labels
- func (s Series) GetMeta() interface{}
- func (s Series) GetName() string
- func (s Series) GetPoint(pointIdx int) (time.Time, *float64)
- func (s Series) GetTime(pointIdx int) time.Time
- func (s Series) GetValue(pointIdx int) *float64
- func (s Series) Len() int
- func (s Series) Reduce(refID, rFunc string, mapper ReduceMapper) (Number, error)
- func (s Series) Resample(refID string, interval time.Duration, downsampler string, upsampler string, ...) (Series, error)
- func (s Series) SetLabels(ls data.Labels)
- func (s Series) SetMeta(v interface{})
- func (s Series) SetPoint(pointIdx int, t time.Time, f *float64)
- func (s Series) SortByTime(desc bool)
- func (s Series) Type() parse.ReturnType
- func (s Series) Value() interface{}
- type SortSeriesByTime
- type State
- type Union
- type Value
- type Values
- type Vars
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Avg ¶
func Avg(fv *Float64Field) *float64
func Count ¶
func Count(fv *Float64Field) *float64
func GetSupportedReduceFuncs ¶
func GetSupportedReduceFuncs() []string
GetSupportedReduceFuncs returns collection of supported function names
func Last ¶
func Last(fv *Float64Field) *float64
func Max ¶
func Max(fv *Float64Field) *float64
func Min ¶
func Min(fv *Float64Field) *float64
func Sum ¶
func Sum(fv *Float64Field) *float64
Types ¶
type DropNonNumber ¶
type DropNonNumber struct { }
func (DropNonNumber) MapInput ¶
func (d DropNonNumber) MapInput(s *float64) *float64
MapInput returns nil if the input parameter is nil or point to either a NaN or a Inf
func (DropNonNumber) MapOutput ¶
func (d DropNonNumber) MapOutput(s *float64) *float64
MapOutput returns nil if the input parameter is nil or point to either a NaN or a Inf
type Expr ¶
Expr holds a parsed math command expression.
type Float64Field ¶
FloatField is a *float64 or a float64 data.Field with methods to always get a *float64.
func (*Float64Field) GetValue ¶
func (ff *Float64Field) GetValue(idx int) *float64
GetValue returns the value at idx as *float64.
func (*Float64Field) Len ¶
func (ff *Float64Field) Len() int
Len returns the the length of the field.
type NoData ¶
NoData is an untyped no data response.
func (NoData) AsDataFrame ¶
func (NoData) Type ¶
func (s NoData) Type() parse.ReturnType
Type returns the Value type and allows it to fulfill the Value interface.
type Number ¶
Number hold a labelled single number values.
func GenerateNumber ¶
func NumberFromRef ¶
NewNumber returns a data that holds a float64Vector
func (Number) AsDataFrame ¶
AsDataFrame returns the underlying *data.Frame.
func (Number) GetFloat64Value ¶
GetFloat64Value retrieves the single scalar value from the data
func (Number) Type ¶
func (n Number) Type() parse.ReturnType
Type returns the Value type and allows it to fulfill the Value interface.
type ReduceMapper ¶
type ReducerFunc ¶
type ReducerFunc = func(fv *Float64Field) *float64
func GetReduceFunc ¶
func GetReduceFunc(rFunc string) (ReducerFunc, error)
type ReplaceNonNumberWithValue ¶
type ReplaceNonNumberWithValue struct {
Value float64
}
func (ReplaceNonNumberWithValue) MapInput ¶
func (r ReplaceNonNumberWithValue) MapInput(v *float64) *float64
MapInput returns a pointer to ReplaceNonNumberWithValue.Value if input parameter is nil or points to either a NaN or an Inf. Otherwise, returns the input pointer as is.
func (ReplaceNonNumberWithValue) MapOutput ¶
func (r ReplaceNonNumberWithValue) MapOutput(s *float64) *float64
MapOutput returns a pointer to ReplaceNonNumberWithValue.Value if input parameter is nil or points to either a NaN or an Inf. Otherwise, returns the input pointer as is.
type Results ¶
type Results struct {
Values Values
}
Results is a container for Value interfaces.
func NewScalarResults ¶
NewScalarResults creates a Results holding a single Scalar
type Scalar ¶
Scalar is the type that holds a single number constant. Before returning from an expression it will be wrapped in a data frame.
func (Scalar) AsDataFrame ¶
AsDataFrame returns the underlying *data.Frame.
func (Scalar) GetFloat64Value ¶
GetFloat64Value retrieves the single scalar value from the data
func (Scalar) Type ¶
func (s Scalar) Type() parse.ReturnType
Type returns the Value type and allows it to fulfill the Value interface.
type Series ¶
Series has a time.Time and a *float64 fields.
func NewSeriesFromRef ¶
func NewSeriesFromRef(refID string, s timeseries.MetricRef) (Series, error)
NewSeries returns a dataframe of type Series.
func SeriesFromFrame ¶
SeriesFromFrame validates that the dataframe can be considered a Series type and mutates the frame to be in the format that additional SSE operations expect.
func (Series) AppendPoint ¶
AppendPoint appends a point (time/value).
func (Series) AsDataFrame ¶
AsDataFrame returns the underlying *data.Frame.
func (Series) Reduce ¶
func (s Series) Reduce(refID, rFunc string, mapper ReduceMapper) (Number, error)
Reduce turns the Series into a Number based on the given reduction function if ReduceMapper is defined it applies it to the provided series and performs reduction of the resulting series. Otherwise, the reduction operation is done against the original series.
func (Series) Resample ¶
func (s Series) Resample(refID string, interval time.Duration, downsampler string, upsampler string, from, to time.Time) (Series, error)
Resample turns the Series into a Number based on the given reduction function
func (Series) SetPoint ¶
SetPoint sets the time and value on the corresponding vectors at the specified index.
func (Series) SortByTime ¶
SortByTime sorts the series by the time from oldest to newest. If desc is true, it will sort from newest to oldest. If any time values are nil, it will panic.
func (Series) Type ¶
func (s Series) Type() parse.ReturnType
Type returns the Value type and allows it to fulfill the Value interface.
type SortSeriesByTime ¶
type SortSeriesByTime Series
SortSeriesByTime allows a Series to be sorted by time the sort interface will panic if any timestamps are null
func (SortSeriesByTime) Len ¶
func (ss SortSeriesByTime) Len() int
func (SortSeriesByTime) Less ¶
func (ss SortSeriesByTime) Less(i, j int) bool
func (SortSeriesByTime) Swap ¶
func (ss SortSeriesByTime) Swap(i, j int)
type State ¶
type State struct { *Expr Vars Vars // Could hold more properties that change behavior around: // - Unions (How many result A and many Result B in case A + B are joined) // - NaN/Null behavior RefID string // contains filtered or unexported fields }
State embeds a parsed Expr with variables and their results so the expression can act on them.
type Union ¶
Union holds to Values from Two sets where their labels are compatible (TODO: define compatible). This is a intermediate container for Binary operations such (e.g. A + B).
type Value ¶
type Value interface { Type() parse.ReturnType Value() interface{} GetLabels() data.Labels SetLabels(data.Labels) GetMeta() interface{} SetMeta(interface{}) AsDataFrame() *data.Frame AddNotice(notice data.Notice) }
Value is the interface that holds different types such as a Scalar, Series, or Number. all Value implementations should be a *data.Frame