Documentation ¶
Index ¶
- 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
- type ConditionGroup
- type ConditionSingle
- type Context
- type Logic
- type Operation
- type OperationBetween
- type OperationEqual
- type OperationEqualGT
- type OperationEqualGTE
- type OperationEqualLT
- type OperationEqualLTE
- type OperationEqualNot
- type OperationFactory
- type OperationHas
- type OperationIn
- type OperationMatch
- type OperationNotIn
- type OperationNotMatch
- type Variable
- type VariableCreator
- type VariableCtx
- type VariableFactory
- type VariableTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Condition ¶
Condition 断言条件接口
func NewCondition ¶
NewCondition 初始化复合条件
func NewConditionGroup ¶
NewConditionGroup 初始化群组条件实例
type ConditionGroup ¶
ConditionGroup 群组条件, 包含 Logic 关系
func (*ConditionGroup) Assert ¶
func (t *ConditionGroup) Assert(ctx *Context) (err error)
Assert ...
type ConditionSingle ¶
type ConditionSingle struct { Variable Variable // 变量 Operation Operation // 操作符 Expect interface{} // 预期结果 }
ConditionSingle 单个条件
func NewConditionSingle ¶
func NewConditionSingle(filter []interface{}) (*ConditionSingle, error)
NewConditionSingle 初始化单个条件实例
type Operation ¶
type Operation interface { Name() string // 操作描述 Expect(value interface{}) (interface{}, error) // 操作预期值 Assert(ctx *Context, variable Variable, value interface{}) bool // 操作断言 }
Operation 操作接口
type OperationBetween ¶
type OperationBetween struct{}
OperationBetween ...
func (*OperationBetween) Assert ¶
func (t *OperationBetween) Assert(ctx *Context, variable Variable, expect interface{}) bool
Assert ...
func (*OperationBetween) Expect ¶
func (t *OperationBetween) Expect(value interface{}) (interface{}, error)
Expect ...
type OperationEqual ¶
type OperationEqual struct{}
OperationEqual ...
func (*OperationEqual) Assert ¶
func (t *OperationEqual) Assert(ctx *Context, variable Variable, expect interface{}) bool
Assert ...
func (*OperationEqual) Expect ¶
func (t *OperationEqual) Expect(value interface{}) (interface{}, error)
Expect ...
type OperationEqualGT ¶
type OperationEqualGT struct {
OperationEqual
}
OperationEqualGT ...
type OperationEqualGTE ¶
type OperationEqualGTE struct {
OperationEqual
}
OperationEqualGTE ...
type OperationEqualLT ¶
type OperationEqualLT struct {
OperationEqual
}
OperationEqualLT ...
type OperationEqualLTE ¶
type OperationEqualLTE struct {
OperationEqual
}
OperationEqualLTE ...
type OperationEqualNot ¶
type OperationEqualNot struct {
OperationEqual
}
OperationEqualNot ...
type OperationFactory ¶
type OperationFactory struct {
// contains filtered or unexported fields
}
OperationFactory 操作实例工厂
func (*OperationFactory) Discovery ¶
func (t *OperationFactory) Discovery(name string) Operation
Discovery 发现操作实例
func (*OperationFactory) Register ¶
func (t *OperationFactory) Register(operation Operation)
Register 注册操作实例
type OperationHas ¶
type OperationHas struct{}
OperationHas ...
func (*OperationHas) Assert ¶
func (t *OperationHas) Assert(ctx *Context, variable Variable, expect interface{}) bool
Assert ...
func (*OperationHas) Expect ¶
func (t *OperationHas) Expect(value interface{}) (interface{}, error)
Expect ...
type OperationIn ¶
type OperationIn struct{}
OperationIn ...
func (*OperationIn) Assert ¶
func (t *OperationIn) Assert(ctx *Context, variable Variable, expect interface{}) bool
Assert ...
func (*OperationIn) Expect ¶
func (t *OperationIn) Expect(value interface{}) (interface{}, error)
Expect ...
type OperationMatch ¶
type OperationMatch struct{}
OperationMatch ...
func (*OperationMatch) Assert ¶
func (t *OperationMatch) Assert(ctx *Context, variable Variable, expect interface{}) bool
Assert ...
func (*OperationMatch) Expect ¶
func (t *OperationMatch) Expect(value interface{}) (interface{}, error)
Expect ...
type OperationNotIn ¶
type OperationNotIn struct {
OperationIn
}
OperationNotIn ...
type OperationNotMatch ¶
type OperationNotMatch struct {
OperationMatch
}
OperationNotMatch ...
type VariableCtx ¶
type VariableCtx struct {
// contains filtered or unexported fields
}
VariableCtx ...
type VariableFactory ¶
type VariableFactory struct {
// contains filtered or unexported fields
}
VariableFactory 变量实例工厂
func (*VariableFactory) Discovery ¶
func (t *VariableFactory) Discovery(name string) Variable
Discovery 发现变量实例
func (*VariableFactory) Register ¶
func (t *VariableFactory) Register(name string, creator VariableCreator)
Register 注册变量实例
type VariableTime ¶
type VariableTime struct {
// contains filtered or unexported fields
}
VariableTime ...