Documentation
¶
Index ¶
- type MaybeOp
- func ErrorOp[S packer.Number, T packer.Number](err error) *MaybeOp[S, T]
- func JustOp[S packer.Number, T packer.Number](op Op[S, T]) *MaybeOp[S, T]
- func NewOpAdd[S packer.Number, T packer.Number]() *MaybeOp[S, T]
- func NewOpMax[T packer.Number](windowSize int) *MaybeOp[T, T]
- func NewOpMin[T packer.Number](windowSize int) *MaybeOp[T, T]
- func NewOpMul[S packer.Number, T packer.Number]() *MaybeOp[S, T]
- func NewOpMulAdd[S packer.Number, T packer.Number](c T) *MaybeOp[S, T]
- func NewOpMulAddT[T packer.Number](c T) *MaybeOp[T, T]
- func NewOpPct[T packer.Number](windowSize int, percentile float64) *MaybeOp[T, T]
- func NewOpSum[T packer.Number](initialValue T, windowSize int) *MaybeOp[T, T]
- type Op
- type OpAdd
- type OpAdd1
- type OpMax
- type OpMin
- type OpMul
- type OpMul1
- type OpMulAdd
- type OpMulAdd1
- type OpPct
- type OpResult
- type OpSum
- type Transformable
- type TxConst
- type TxIdentity
- type TxNegate
- type TxSeries
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MaybeOp ¶
Provides functionality similar to the Maybe monad in Haskell. This is used to represent the result of an operation that can either be an error or a valid operation.
func NewOpMulAdd ¶
Create a new OpMulAdd operation with the specified constant C that can be applied on two time series A and B to generate a new time series which is the equavalent of C * A + B
func NewOpMulAddT ¶
func (*MaybeOp[S, T]) Apply ¶
func (op *MaybeOp[S, T]) Apply(args Transformable[S, T]) *MaybeOp[S, T]
Apply the operation on the specified transformable and return a new operator that can either represent the resulting values of this operation or be further curried.
func (*MaybeOp[S, T]) Values ¶
func (op *MaybeOp[S, T]) Values() *TxIdentity[T, T]
Return the final values produced by the operator, otherwise returns nil
type Op ¶
type Op[S packer.Number, T packer.Number] interface { // Applies this frame operator on the specified args and returns an // operator that can either represent the retulting values of this // operation or be curried further. Apply(args Transformable[S, T]) *MaybeOp[S, T] // Return the final values produced by the operator, otherwise returns nil Values() *TxIdentity[T, T] }
Defines an interface for functional frame operations on vector valued transformable data.
type OpAdd ¶
Represents an add operation that can be applied on two time series. OpAdd invokation takes one time series as an input and return an instance of OpAdd1 which can be curried further with another time series to generate final sum.
func (*OpAdd[S, T]) Apply ¶
func (op *OpAdd[S, T]) Apply(args Transformable[S, T]) *MaybeOp[S, T]
Apply the OpAdd operator on the specified args and return an operator that can be curreried further.
func (*OpAdd[S, T]) Values ¶
func (op *OpAdd[S, T]) Values() *TxIdentity[T, T]
Returns a nil TxIdentity. Add operation require two time series. OpAdd Apply() results in an operator which needs to be further applied on another time series before producing results.
type OpAdd1 ¶
Represents an add operation that can be applied on two time series. OpAdd1 is an internal representation of OpAdd which contains the first time series and can take the second operand to generate the final sum.
func (*OpAdd1[S, T]) Apply ¶
func (op1 *OpAdd1[S, T]) Apply(args Transformable[S, T]) *MaybeOp[S, T]
Apply the OpAdd1 operator on the specified args and returns the final result (sum of two series) as an operator.
func (*OpAdd1[S, T]) Values ¶
func (op *OpAdd1[S, T]) Values() *TxIdentity[T, T]
Returns a nil TxIdentity. Add operation require two time series. OpAdd1 is a curried operator which needs to be further applied on another time series before producing results.
type OpMax ¶
Return an operation that return the maximum value of a time series over a specified window size.
func (*OpMax[S, T]) Apply ¶
func (op *OpMax[S, T]) Apply(args Transformable[S, T]) *MaybeOp[S, T]
Apply the OpMin operator on the specified args and return an operator that contains the minimum value of the values over the specified windowSize.
func (*OpMax[S, T]) Values ¶
func (op *OpMax[S, T]) Values() *TxIdentity[T, T]
Returns a nil TxIdentity. Min operation is the result of the Apply function. The result is returned as an operator from the Apply invocation.
type OpMin ¶
Return an operation that return the minimum value of a time series over a specified window size.
func (*OpMin[S, T]) Apply ¶
func (op *OpMin[S, T]) Apply(args Transformable[S, T]) *MaybeOp[S, T]
Apply the OpMin operator on the specified args and return an operator that contains the minimum value of the values over the specified windowSize.
func (*OpMin[S, T]) Values ¶
func (op *OpMin[S, T]) Values() *TxIdentity[T, T]
Returns a nil TxIdentity. Min operation is the result of the Apply function. The result is returned as an operator from the Apply invocation.
type OpMul ¶
Represents a multiply operation that can be applied on two time series. OpMul invokation takes one time series as an input and return an instance of OpMul1 which can be curried further with another time series to generate final product.
func (*OpMul[S, T]) Apply ¶
func (op *OpMul[S, T]) Apply(args Transformable[S, T]) *MaybeOp[S, T]
Apply the OpMul operator on the specified args and return an operator that can be curreried further.
func (*OpMul[S, T]) Values ¶
func (op *OpMul[S, T]) Values() *TxIdentity[T, T]
Returns a nil TxIdentity. Mul operation require two time series. OpMula Apply() results in an operator which needs to be further applied on anothera time series before producing results.
type OpMul1 ¶
Represents a multiply operation that can be applied on two time series. OpMul1 is an internal representation of OpAdd which contains the first time series and can take the second operand to generate the final product.
func (*OpMul1[S, T]) Apply ¶
func (op1 *OpMul1[S, T]) Apply(args Transformable[S, T]) *MaybeOp[S, T]
Apply the OpMul1 operator on the specified args and returns the final result (product of the two series) as an operator.
func (*OpMul1[S, T]) Values ¶
func (op *OpMul1[S, T]) Values() *TxIdentity[T, T]
Returns a nil TxIdentity. Mul operation require two time series. OpMul a curried operator which needs to be further applied on another time series before producing results.
type OpMulAdd ¶
type OpMulAdd[S packer.Number, T packer.Number] struct { // contains filtered or unexported fields }
func (*OpMulAdd[S, T]) Apply ¶
func (op *OpMulAdd[S, T]) Apply(args Transformable[S, T]) *MaybeOp[S, T]
Apply the operation on the specified values and return true if the value has been modified inplace. Otherwise, return false.
func (*OpMulAdd[S, T]) Values ¶
func (op *OpMulAdd[S, T]) Values() *TxIdentity[T, T]
type OpMulAdd1 ¶
type OpMulAdd1[S packer.Number, T packer.Number] struct { // contains filtered or unexported fields }
func (*OpMulAdd1[S, T]) Apply ¶
func (op1 *OpMulAdd1[S, T]) Apply(args Transformable[S, T]) *MaybeOp[S, T]
func (*OpMulAdd1[S, T]) Values ¶
func (op *OpMulAdd1[S, T]) Values() *TxIdentity[T, T]
type OpPct ¶
Represents a percentile operation that can be applied on a transformable array. The percentile is computed over a window of values.
func (*OpPct[S, T]) Apply ¶
func (op *OpPct[S, T]) Apply(args Transformable[S, T]) *MaybeOp[S, T]
Apply the OpPct operator on the specified args and return an operator that contains the percentiles computed over the specified windowSize.
func (*OpPct[S, T]) Values ¶
func (op *OpPct[S, T]) Values() *TxIdentity[T, T]
Return a nil TxIdentity. Pct operation require a time series. OpPct Apply() can be called to get the result of the operation.
type OpResult ¶
type OpResult[S packer.Number, T packer.Number] struct { // contains filtered or unexported fields }
func (*OpResult[S, T]) Apply ¶
func (result *OpResult[S, T]) Apply(args Transformable[S, T]) *MaybeOp[S, T]
func (*OpResult[S, T]) Values ¶
func (result *OpResult[S, T]) Values() *TxIdentity[T, T]
type OpSum ¶
Represents an operation that can be applied on a time series to generate windowed sum of the values.
func (*OpSum[S, T]) Apply ¶
func (op *OpSum[S, T]) Apply(args Transformable[S, T]) *MaybeOp[S, T]
Apply the OpSum operator on the specified args and return an operator that contains the sum of the values over the specified windowSize.
func (*OpSum[S, T]) Values ¶
func (op *OpSum[S, T]) Values() *TxIdentity[T, T]
Returns a nil TxIdentity. Sum operation is the result of the Apply function. The result is returned as an operator from the Apply invocation.
type Transformable ¶
type Transformable[S packer.Number, T packer.Number] interface { // Tranform the values of the underlying transformable array and return the // value at the specified index. ValueAt(idx int) T // Return the time at the specified index. TimeAt(idx int) uint64 // Return true if the underlying transformable array is empty. IsEmpty() bool // Return the length of the underlying transformable array. Length() int }
Defines an interface for representing transformable data.
func NewTxNegate ¶
func NewTxNegate[T packer.Number](values []T) Transformable[T, T]
type TxIdentity ¶
type TxIdentity[S packer.Number, T packer.Number] struct { // contains filtered or unexported fields }
Defines a struct for representing an identity transformation of an array of values in type T.
func NewTxIdentity ¶
func NewTxIdentity[T packer.Number](values []T) *TxIdentity[T, T]
Create a new TxIdentity struct with the specified values.
func NewTxIdentityWithTime ¶
func NewTxIdentityWithTime[T packer.Number](values []T, time []uint64) *TxIdentity[T, T]
Create a new TxIdentity struct with the specified values and time.
func (*TxIdentity[S, T]) IsEmpty ¶
func (tx *TxIdentity[S, T]) IsEmpty() bool
Return true if the underlying transformable array is empty.
func (*TxIdentity[S, T]) Length ¶
func (tx *TxIdentity[S, T]) Length() int
Return the length of the underlying transformable array.
func (*TxIdentity[S, T]) TimeAt ¶
func (tx *TxIdentity[S, T]) TimeAt(idx int) uint64
Return the time at the specified index.
func (*TxIdentity[S, T]) ValueAt ¶
func (tx *TxIdentity[S, T]) ValueAt(idx int) T
Return the value at the specified index.