Logical Combinators¶
This shows all the logical objects and usages.
All of these classes are importable from alaric.logical
Or¶
- class alaric.logical.OR(*comparisons: ComparisonT | LogicalT | Buildable | List[ComparisonT | LogicalT | Buildable])¶
Conduct a logical OR between all items passed to the constructor.
Lets build a check using a simple OR which will return all results the field
my_fieldis eitherTrueOR a number in the list[1, 2, 3, 7, 8, 9]1from alaric import AQ 2from alaric.logical import OR 3from alaric.comparison import EQ, IN 4 5query = AQ(OR(EQ("my_field", True), IN("my_field", [1, 2, 3, 7, 8, 9])))
And¶
- class alaric.logical.AND(*comparisons: ComparisonT | LogicalT | Buildable | List[ComparisonT | LogicalT | Buildable])¶
Conduct a logical AND between all items passed to the constructor.
Lets build a query which returns all results where the field
discordis equal toSkelmis#9135andgamer_tagis equal toSkelmis1from alaric import AQ 2from alaric.logical import AND 3from alaric.comparison import EQ 4 5query = AQ(AND(EQ("discord", "Skelmis#9135"), EQ("gamer_tag", "Skelmis")))
Not¶
- class alaric.logical.NOT(*comparisons: ComparisonT | LogicalT | Buildable | List[ComparisonT | LogicalT | Buildable])¶
Invert the effect of a query expression.
This back-links to here
Lets find all items where my
gamer_tagdoes NOT matchSkelmis1from alaric import AQ 2from alaric.logical import NOT 3from alaric.comparison import EQ 4 5query = AQ(NOT(EQ("gamer_tag", "Skelmis")))