Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { PadValue DataValue IntervalColName string IntervalFunc IntervalFunc WindowSize int Position string // center/start/end }
It should be considered a private implementation detail and should never be referenced or used directly outside of the QFrame code. To manipulate it use the functions returning ConfigFunc below.
func NewConfig ¶
func NewConfig(ff []ConfigFunc) (Config, error)
type ConfigFunc ¶
type ConfigFunc func(c *Config)
ConfigFunc is a function that operates on a Config object.
func IntervalFunction ¶
func IntervalFunction(colName string, fn IntervalFunc) ConfigFunc
IntervalFunction can be used to set a dynamic interval based on the content of another column. QFrame will include all rows from the start row of the window until (but not including) the first row that is not part of the interval according to 'fn'. The first parameter passed to 'fn' is always the value at the start of the window.
For example, lets say that you have a time series with millisecond resolution integer timestamps in column 'ts' and values in column 'value' that you would like to compute a rolling average over a minute for.
In this case: col = "ts", fn = func(tsStart, tsEnd int) bool { return tsEnd < tsStart + int(time.Minute / time.Millisecond)}
func PadValue ¶
func PadValue(v DataValue) ConfigFunc
PadValue can be used to set the value to use in the beginning and/or end of the column to fill out any values where fewer than WindowSize values are available.
func Position ¶
func Position(p string) ConfigFunc
Position is used to set where in window the resulting value should be inserted. Valid values: start/center/end Default value: center
func WindowSize ¶
func WindowSize(s int) ConfigFunc
WindowSize is used to set the size of the Window. By default this is 1.
type DataValue ¶
type DataValue = interface{}
DataValue can be any of int/float/*string/bool, eg. any type that a column may take.
type IntervalFunc ¶
type IntervalFunc = interface{}
IntervalFunc is a function taking two parameters of the same DataValue and returning boolean stating if the two values are part of the same interval or not.
For example, x and y within one unit from each other (with x assumed to be <= y):