Comparators¶
Comparator operations are declared using JSON with following structure:
{"field": "<fieldname>", "operator", "<operator>", "value": "<comparison value>"}
Available operators¶
-
class
rulez.operator.And(operator, engine, value, value_type=None)¶ Apply boolean
ANDcondition to list of valuesOperator: andValue_types: list,tupleItems in values have to be a compilable
rulezoperator JSON
-
class
rulez.operator.Equal(operator, engine, field, value, value_type=None)¶ Compare whether contents of field is same as value
Operator: ==Value_types: rulez_operation,str,float,int
-
class
rulez.operator.Get(operator, engine, value, value_type=None)¶ Get value from a field
Operator: getValue_types: field_name
-
class
rulez.operator.GreaterEqualThan(operator, engine, field, value, value_type=None)¶ Compare whether contents of field is greater equal than value
Operator: >=Value_types: rulez_operation,str,float,int
-
class
rulez.operator.GreaterThan(operator, engine, field, value, value_type=None)¶ Compare whether contents of field is greater than value
Operator: >Value_types: rulez_operation,str,float,int
-
class
rulez.operator.In(operator, engine, field, value, value_type=None)¶ Apply boolean
ORcondition to list of valuesOperator: orValue_types: list[rulez_operation],tuple[rulez_operation],list[str],list[float],list[int]
-
class
rulez.operator.LessEqualThan(operator, engine, field, value, value_type=None)¶ Compare whether contents of field is less equal than value
Operator: <=Value_types: rulez_operation,str,float,int
-
class
rulez.operator.LessThan(operator, engine, field, value, value_type=None)¶ Compare whether contents of field is less than value
Operator: <Value_types: rulez_operation,str,float,int
-
class
rulez.operator.Like(operator, engine, field, value, value_type=None)¶ Compare whether contents of field is like value
Operator: ~Value_types: str
-
class
rulez.operator.Match(operator, engine, field, value, value_type=None)¶ Compare whether contents of field matches value
Operator: matchValue_types: strWarning
This operator only supported in
sqlalchemycompiler.
-
class
rulez.operator.NotEqual(operator, engine, field, value, value_type=None)¶ Compare whether contents of field is not equal to value
Operator: !=Value_types: rulez_operation,str,float,int
-
class
rulez.operator.Or(operator, engine, value, value_type=None)¶ Apply boolean
ORcondition to list of valuesOperator: orValue_types: list[rulez_operation],tuple[rulez_operation]Items in values have to be a compilable
rulezoperation JSON
Comparing contents of 2 fields¶
We can also compare contents of 2 fields by using comparison operators
{
"field": "<fieldname1>",
"operator": "<operator>",
"value": {
"operator": "get",
"value": "<fieldname2>"
}
}