Documentation ¶
Index ¶
- func Avg(v *data.Field) *float64
- func Count(fv *data.Field) *float64
- func Max(fv *data.Field) *float64
- func Min(fv *data.Field) *float64
- func Sum(v *data.Field) *float64
- type Expr
- type Number
- type Results
- type Scalar
- 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) 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) 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 ¶
Types ¶
type Expr ¶
Expr holds a parsed math command expression.
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 ¶
type Series struct { Frame *data.Frame TimeIsNullable bool TimeIdx int ValueIsNullable bool ValueIdx int }
Series has time.Time and ...? *float64 fields.
func NewSeries ¶
func NewSeries(refID string, labels data.Labels, timeIdx int, nullableTime bool, valueIdx int, nullableValue bool, size int) Series
NewSeries returns a dataframe of type Series.
func SeriesFromFrame ¶
SeriesFromFrame validates that the dataframe can be considered a Series type and populate meta information on Series about the frame.
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, tr backend.TimeRange) (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) 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