Versions in this module Expand all Collapse all v1 v1.0.1 Dec 4, 2023 Changes in this version + func Assert(ctx *Context, rule string) error + func Filter(ctx *Context, list []map[string]interface{}) ([]map[string]interface{}, error) + func ParseFilter(rule string) ([]interface{}, error) + type Condition interface + Assert func(*Context) error + Name func() string + func NewCondition(filters []interface{}) (Condition, error) + func NewConditionGroup(filters []interface{}) (Condition, error) + type ConditionGroup struct + Conditions []Condition + Logic Logic + func (t *ConditionGroup) Assert(ctx *Context) (err error) + func (t *ConditionGroup) Name() string + type ConditionSingle struct + Expect interface{} + Operation Operation + Variable Variable + func NewConditionSingle(filter []interface{}) (*ConditionSingle, error) + func (t *ConditionSingle) Assert(ctx *Context) error + func (t *ConditionSingle) Name() string + type Context struct + func NewContext(ctxs ...context.Context) *Context + func (t *Context) Ctx(k string) interface{} + func (t *Context) Get(k string) (interface{}, bool) + func (t *Context) Set(k string, v interface{}) + type Logic string + const LogicAnd + const LogicOr + func ToLogic(s string) Logic + func (t Logic) String() string + type Operation interface + Assert func(ctx *Context, variable Variable, value interface{}) bool + Expect func(value interface{}) (interface{}, error) + Name func() string + func NewOperation(operationName string) (Operation, error) + type OperationBetween struct + func (t *OperationBetween) Assert(ctx *Context, variable Variable, expect interface{}) bool + func (t *OperationBetween) Expect(value interface{}) (interface{}, error) + func (t *OperationBetween) Name() string + type OperationEqual struct + func (t *OperationEqual) Assert(ctx *Context, variable Variable, expect interface{}) bool + func (t *OperationEqual) Expect(value interface{}) (interface{}, error) + func (t *OperationEqual) Name() string + type OperationEqualGT struct + func (t *OperationEqualGT) Assert(ctx *Context, variable Variable, expect interface{}) bool + func (t *OperationEqualGT) Name() string + type OperationEqualGTE struct + func (t *OperationEqualGTE) Assert(ctx *Context, variable Variable, expect interface{}) bool + func (t *OperationEqualGTE) Name() string + type OperationEqualLT struct + func (t *OperationEqualLT) Assert(ctx *Context, variable Variable, expect interface{}) bool + func (t *OperationEqualLT) Name() string + type OperationEqualLTE struct + func (t *OperationEqualLTE) Assert(ctx *Context, variable Variable, expect interface{}) bool + func (t *OperationEqualLTE) Name() string + type OperationEqualNot struct + func (t *OperationEqualNot) Assert(ctx *Context, variable Variable, expect interface{}) bool + func (t *OperationEqualNot) Name() string + type OperationFactory struct + func (t *OperationFactory) Discovery(name string) Operation + func (t *OperationFactory) Register(operation Operation) + type OperationHas struct + func (t *OperationHas) Assert(ctx *Context, variable Variable, expect interface{}) bool + func (t *OperationHas) Expect(value interface{}) (interface{}, error) + func (t *OperationHas) Name() string + type OperationIn struct + func (t *OperationIn) Assert(ctx *Context, variable Variable, expect interface{}) bool + func (t *OperationIn) Expect(value interface{}) (interface{}, error) + func (t *OperationIn) Name() string + type OperationMatch struct + func (t *OperationMatch) Assert(ctx *Context, variable Variable, expect interface{}) bool + func (t *OperationMatch) Expect(value interface{}) (interface{}, error) + func (t *OperationMatch) Name() string + type OperationNotIn struct + func (t *OperationNotIn) Assert(ctx *Context, variable Variable, expect interface{}) bool + func (t *OperationNotIn) Name() string + type OperationNotMatch struct + func (t *OperationNotMatch) Assert(ctx *Context, variable Variable, expect interface{}) bool + func (t *OperationNotMatch) Name() string + type Variable interface + Name func() string + Value func(*Context) interface{} + func NewVariable(name string) (Variable, error) + type VariableCreator = func(string) Variable + type VariableCtx struct + func (t *VariableCtx) Name() string + func (t *VariableCtx) Value(ctx *Context) interface{} + type VariableFactory struct + func (t *VariableFactory) Discovery(name string) Variable + func (t *VariableFactory) Register(name string, creator VariableCreator) + type VariableTime struct + func (t *VariableTime) Name() string + func (t *VariableTime) Value(ctx *Context) interface{}