Skip to main content

Module logical

Module logical 

Source
Expand description

or_() and and_(), and the ConditionGroup they make.

A group writes one set of brackets around its whole chain and none around each operand. A chain stays flat while the operator does not change: a.or_(b).or_(c) gives (a OR b OR c). Nesting makes a different group: a.or_(b.or_(c)) gives (a OR (b OR c)).

The group writes the brackets, not the statement renderer: WHERE joins its conditions with a plain AND, so a search on top of a table’s conditions reads role = 'admin' AND (a OR b). Without the group it would read role = 'admin' AND a OR b, which means (role = 'admin' AND a) OR b.

Structs§

ConditionGroup
Conditions that one logical operator joins, written as a single group in brackets. To make a group, call or_ or and_, or use the or_ and and_ methods on a column or an identifier.

Functions§

and_
Joins two conditions with AND: (lhs AND rhs).
or_
Joins two conditions with OR: (lhs OR rhs).