Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasFunction ¶
func InitialFirst ¶
InitialFirst returns the first valid metric in a Value. If the Value has no valid metrics then it returns the original value.
func InitialInvalid ¶
InitialInvalid returns an invalid Value. It's used for functions using Calculation's, where we want to start the aggregation without an initial starting value.
Types ¶
type Aggregator ¶
func MathAggregator ¶
func MathAggregator(o SingleMathOperation) Aggregator
MathAggregator applies a SingleMathOperation against the result
type Function ¶
type Function struct { // Args is the number of arguments a Function requires. // This overrides MinArg and MaxArg if MinArg < Args > MaxArg Args int // MinArg is the minimum number of arguments a Function accepts. // Default 0 MinArg int // MaxArg is the maximum number of arguments a Function accepts. // Default 0, if this is less than MinArg then the function supports MaxInt arguments MaxArg int // Initial is a function to be called to get the initial valur for an aggregator. // If not set then InitialFirst is used. Initial FunctionInitialiser // Reducer is a value.Comparator used to determine which value to keep. // If comparator(a,b) returns true then a is used, otherwise b. Reducer value.Comparator // Calculation is a value.Calculation which performs an operation against two Value's // returning a new one. Calculation value.Calculation // calculation of a and b // Aggregator is a function which will convert a Value based on the number of values // passed through the aggregator. // // l=number of entries in set, return Value based on l and result Aggregator Aggregator // Function is called after any aggregations have been performed. Function FunctionHandler // Handler for specific functions // AggregateArguments if set will apply the aggregator against the arguments before passing // the single result to the Function. // This only applies if Function is set. AggregateArguments bool }
Function definition
func GetFunction ¶
func (Function) IsAggregator ¶
IsAggregator returns true if one of Reducer, Calculation or Aggregator is defined.
type FunctionHandler ¶
type FunctionMap ¶
type FunctionMap struct {
// contains filtered or unexported fields
}
func AddFunction ¶
func AddFunction(n string, ag Function) *FunctionMap
func (*FunctionMap) AddFunction ¶
func (f *FunctionMap) AddFunction(n string, ag Function)
func (*FunctionMap) GetFunction ¶
func (f *FunctionMap) GetFunction(n string) (Function, bool)
func (*FunctionMap) HasFunction ¶
func (f *FunctionMap) HasFunction(n string) bool
type SingleMathOperation ¶
Click to show internal directories.
Click to hide internal directories.