iris_operators

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Max = "max"
	Sum = "sum"
)
View Source
const (
	OperatorGt  = ">"
	OperatorLt  = "<"
	OperatorEq  = "=="
	OperatorNeq = "!="
	OperatorGte = ">="
	OperatorLte = "<="

	Gt  = "gt"
	Gte = "gte"
	Lt  = "lt"
	Lte = "lte"
	Eq  = "eq"
	Neq = "neq"

	DataTypeBool    = "bool"
	DataTypeInt     = "int"
	DataTypeStr     = "string"
	DataTypeFloat64 = "float64"
)

Variables

This section is empty.

Functions

func ConvertToFloat64

func ConvertToFloat64(value any) (float64, bool)

func ConvertToInt

func ConvertToInt(value any) (int, bool)

func GetOp

func GetOp(op string) (string, error)

Types

type AggOp

type AggOp string

func (AggOp) Max

func (a AggOp) Max() string

func (AggOp) Sum

func (a AggOp) Sum() string

type Aggregation

type Aggregation struct {
	Name       string                   `json:"name,omitempty"`
	Operator   AggOp                    `json:"operator"`
	Comparison *Operation               `json:"comparison,omitempty"`
	DataType   string                   `json:"dataType"`
	DataSlice  []IrisRoutingResponseETL `json:"dataSlice"`

	SumInt            int     `json:"sumInt,omitempty"`
	CurrentMinInt     int     `json:"currentMinInt,omitempty"`
	CurrentMaxInt     int     `json:"currentMaxInt,omitempty"`
	CurrentMaxFloat64 float64 `json:"CurrentMaxFloat64,omitempty"`
}

func (*Aggregation) AggregateEqInt

func (a *Aggregation) AggregateEqInt(x IrisRoutingResponseETL) error

func (*Aggregation) AggregateGtEqInt

func (a *Aggregation) AggregateGtEqInt(x IrisRoutingResponseETL) error

func (*Aggregation) AggregateGtInt

func (a *Aggregation) AggregateGtInt(x IrisRoutingResponseETL) error

func (*Aggregation) AggregateLtEqInt

func (a *Aggregation) AggregateLtEqInt(x IrisRoutingResponseETL) error

func (*Aggregation) AggregateLtInt

func (a *Aggregation) AggregateLtInt(x IrisRoutingResponseETL) error

func (*Aggregation) AggregateMaxFloat64

func (a *Aggregation) AggregateMaxFloat64(x float64, y IrisRoutingResponseETL) error

func (*Aggregation) AggregateMaxInt

func (a *Aggregation) AggregateMaxInt(x int, y IrisRoutingResponseETL) error

func (*Aggregation) AggregateNeqInt

func (a *Aggregation) AggregateNeqInt(x IrisRoutingResponseETL) error

func (*Aggregation) AggregateOn

func (a *Aggregation) AggregateOn(x any, y IrisRoutingResponseETL) error

AggregateOn order of priority, and will only execute the first valid operator: comparison operator || agg operator

func (*Aggregation) AggregateSumInt

func (a *Aggregation) AggregateSumInt(x int, y IrisRoutingResponseETL) error

type IrisRoutingResponseETL

type IrisRoutingResponseETL struct {
	Source        string `json:"source"`
	ExtractionKey string `json:"extractionKey"`
	DataType      string `json:"dataType"`
	Value         any    `json:"result"`
}

func (*IrisRoutingResponseETL) ExtractKeyValue

func (r *IrisRoutingResponseETL) ExtractKeyValue(m map[string]interface{})

type Op

type Op string

func (Op) Eq

func (o Op) Eq() string

func (Op) Gt

func (o Op) Gt() string

func (Op) Gte

func (o Op) Gte() string

func (Op) Lt

func (o Op) Lt() string

func (Op) Lte

func (o Op) Lte() string

func (Op) Neq

func (o Op) Neq() string

type Operation

type Operation struct {
	Operator  Op     `json:"operator"`
	DataTypeX string `json:"dataTypeX"`
	DataTypeY string `json:"dataTypeY"`
	DataTypeZ string `json:"dataTypeZ"`
	X         any    `json:"dataInX,"`
	Y         any    `json:"dataInY,omitempty"`
	Z         any    `json:"-,omitempty"`
}

func (*Operation) Compute

func (o *Operation) Compute(operator Op, x any, y any) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL