Constraints
Constraints
Constraints(conjunction: Conjunction = Conjunction.AND)
Bases: object
Constraints object for the Object mapper API
constraints property
constraints: Optional[list]
The constraints as an expression array, or None if empty.
literal
literal(value: Any) -> Any
Convert a value into an expression-array literal.
Strings starting with $ are escaped so they are not read as property references, _date wrappers become to_date calls, and lists become array constructors.
predicate
predicate(key: str, op: str, value: Any) -> list
Build a single ["$key", op, value] comparison.
to_expression
to_expression(constraints) -> Optional[list]
Convert property-keyed constraints into an expression array.
{"age": [">=", 20, "<=", 90], "name": ["==", "x"]} becomes ["all", ["$age", ">=", 20], ["$age", "<=", 90], ["$name", "==", "x"]]. Nested all/any groups are converted recursively. Expression arrays are returned unchanged, and empty constraints return None.