Documentation ¶
Overview ¶
Example ¶
msg := "Hello, 世界" encoded := base64.StdEncoding.EncodeToString([]byte(msg)) fmt.Println(encoded) decoded, err := base64.StdEncoding.DecodeString(encoded) if err != nil { fmt.Println("decode error:", err) return } fmt.Println(string(decoded))
Output: SGVsbG8sIOS4lueVjA== Hello, 世界
Index ¶
- Variables
- func ExecuteTemplate(c ruleql.Context, expr string) []byte
- func NewBinCallableFunc(message stream.PublishMessage) map[string]ruleql.ContextCallableFunc
- func NewJsonCallableFunc(message stream.PublishMessage) map[string]ruleql.ContextCallableFunc
- type AggregateAcc
- type AggregateData
- type AvgAggregateData
- type Context
- type ContextAggCallableFunc
- type CountAggregateData
- type MaxAggregateData
- type MinAggregateData
- type Node
- type SumAggregateData
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnsupportType = fmt.Errorf("only supported float64 & int64 type") ErrExpectInt = fmt.Errorf("Expect int type for operands") ErrExpectBothInt = fmt.Errorf("Expect int type for both operands") ErrUnknownFunction = fmt.Errorf("Unknown math function name") )
View Source
var AggregateFuncs = map[string]AggregateAcc{ "avg": NewAvgAggregateFunc, "sum": NewSumAggregateFunc, "max": NewMaxAggregateFunc, "min": NewMinAggregateFunc, }
View Source
var (
UNDEFINED_RESULT = ruleql.UNDEFINED_RESULT
)
Functions ¶
func ExecuteTemplate ¶
Value get value from context
func NewBinCallableFunc ¶
func NewBinCallableFunc(message stream.PublishMessage) map[string]ruleql.ContextCallableFunc
func NewJsonCallableFunc ¶
func NewJsonCallableFunc(message stream.PublishMessage) map[string]ruleql.ContextCallableFunc
Types ¶
type AggregateAcc ¶
type AggregateAcc func() AggregateData
type AggregateData ¶
func NewAvgAggregateFunc ¶
func NewAvgAggregateFunc() AggregateData
func NewCountAggregateFunc ¶
func NewCountAggregateFunc() AggregateData
func NewMaxAggregateFunc ¶
func NewMaxAggregateFunc() AggregateData
func NewMinAggregateFunc ¶
func NewMinAggregateFunc() AggregateData
func NewSumAggregateFunc ¶
func NewSumAggregateFunc() AggregateData
type AvgAggregateData ¶
type AvgAggregateData struct {
// contains filtered or unexported fields
}
func (*AvgAggregateData) Clean ¶
func (fn *AvgAggregateData) Clean() error
func (*AvgAggregateData) Result ¶
func (fn *AvgAggregateData) Result() ruleql.Node
type Context ¶
func NewMessageContext ¶
func NewMessageContext(message stream.PublishMessage) Context
NewJSONContext new context from json
type ContextAggCallableFunc ¶
type CountAggregateData ¶
type CountAggregateData struct {
// contains filtered or unexported fields
}
func (*CountAggregateData) Clean ¶
func (fn *CountAggregateData) Clean() error
func (*CountAggregateData) Result ¶
func (fn *CountAggregateData) Result() ruleql.Node
type MaxAggregateData ¶
type MaxAggregateData struct {
// contains filtered or unexported fields
}
func (*MaxAggregateData) Clean ¶
func (fn *MaxAggregateData) Clean() error
func (*MaxAggregateData) Result ¶
func (fn *MaxAggregateData) Result() ruleql.Node
type MinAggregateData ¶
type MinAggregateData struct {
// contains filtered or unexported fields
}
func (*MinAggregateData) Clean ¶
func (fn *MinAggregateData) Clean() error
func (*MinAggregateData) Result ¶
func (fn *MinAggregateData) Result() ruleql.Node
type SumAggregateData ¶
type SumAggregateData struct {
// contains filtered or unexported fields
}
func (*SumAggregateData) Clean ¶
func (fn *SumAggregateData) Clean() error
func (*SumAggregateData) Result ¶
func (fn *SumAggregateData) Result() ruleql.Node
Click to show internal directories.
Click to hide internal directories.