def _build_criterion_expression(
         self, operator_: str, left: Term,
         right: Term) -> Union[BasicCriterion, Not, NullCriterion]:
     if operator_ == "equals":
         return left.eq(right)
     elif operator_ == "not-equals":
         return left.ne(right)
     elif operator_ == 'empty':
         return left.isnull()
     elif operator_ == 'not-empty':
         return left.notnull()
     elif operator_ == "more":
         return left.gt(right)
     elif operator_ == "more-equals":
         return left.gte(right)
     elif operator_ == "less":
         return left.lt(right)
     elif operator_ == "less-equals":
         return left.lte(right)
     elif operator_ == 'in':
         return left.isin(right)
     elif operator_ == 'not-in':
         return left.notin(right)
     else:
         # TODO more operator support
         raise NotImplementedError("filter operator is not supported")
Exemple #2
0
def not_in(field: Term, value: Any) -> Criterion:
    if value:
        return field.notin(value) | field.isnull()
    return BasicCriterion(Equality.eq, ValueWrapper(1), ValueWrapper(1))
Exemple #3
0
def not_in(field: Term, value: Any) -> Criterion:
    return field.notin(value) | field.isnull()