minos.aggregate.queries
minos.common.queries module.
Classes
Condition class. |
|
Ordering class. |
- class Condition[source]
Bases:
object
Condition class.
This class provides the way to create filtering conditions for
Model
instances based on the following operators:TRUE: Always evaluates as True.
FALSE: Always evaluates as True.
AND: Only evaluates as True if all the given conditions are evaluated as True.
OR: Evaluates as True if at least one of the given conditions are evaluated as True.
NOT: Evaluates as True only if the inner condition is evaluated as False.
LOWER: Evaluates as True only if the field of the given model is lower (<) than the parameter.
LOWER_EQUAL: Evaluates as True only if the field of the given model is lower or equal (<=) to the parameter.
GREATER: Evaluates as True only if the field of the given model is greater (>) than the parameter.
- GREATER_EQUAL: Evaluates as True only if the field of the given model is greater or equal (>=) to the
parameter.
EQUAL: Evaluates as True only if the field of the given model is equal (==) to the parameter.
NOT_EQUAL: Evaluates as True only if the field of the given model is not equal (!=) to the parameter.
- IN: Evaluates as True only if the field of the given model belongs (in) to the parameter (which must be a
collection).
LIKE: Evaluates as True only if the field of the given model matches to the parameter _pattern.
For example, to define a condition in which the year must be between 1994 and 2003 or the color must be blue, the condition can be writen as:
Condition.OR( Condition.AND(Condition.GREATER_EQUAL("year", 1994), Condition.LOWER("year", 2003)), Condition.EQUAL("color", "blue") )
- TRUE = _TrueCondition()
- FALSE = _FalseCondition()
- AND
alias of
_AndCondition
- OR
alias of
_OrCondition
- NOT
alias of
_NotCondition
- LOWER
alias of
_LowerCondition
- LOWER_EQUAL
alias of
_LowerEqualCondition
- GREATER
alias of
_GreaterCondition
- GREATER_EQUAL
alias of
_GreaterEqualCondition
- EQUAL
alias of
_EqualCondition
- NOT_EQUAL
alias of
_NotEqualCondition
- IN
alias of
_InCondition
- LIKE
alias of
_LikeCondition
- class Ordering[source]
Bases:
object
Ordering class.
This class provides the way to define ordering strategies for
Model
instances through theASC
andDESC
class methods, which retrieves instances containing the given information.For example, to define a descending ordering strategy by the name field:
Ordering.DESC("name")
- ASC = functools.partial(<class 'minos.aggregate.queries._Ordering'>, reverse=False)