Documentation
¶
Index ¶
- func Avg(fv *Float64Field) *float64
- func Count(fv *Float64Field) *float64
- func Max(fv *Float64Field) *float64
- func Min(fv *Float64Field) *float64
- func Sum(fv *Float64Field) *float64
- type Expr
- type Float64Field
- type Number
- 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 Results
- type Scalar
- 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) AppendPoint(pointIdx int, t time.Time, f *float64) (err error)
- 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) (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) (err error)
- 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 Max ¶
func Max(fv *Float64Field) *float64
func Min ¶
func Min(fv *Float64Field) *float64
func Sum ¶
func Sum(fv *Float64Field) *float64
Types ¶
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 Number ¶
Number hold a labelled single number values.
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 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 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) 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
}
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
}
Value is the interface that holds different types such as a Scalar, Series, or Number. all Value implementations should be a *data.Frame