Skip to main content

or

Function or 

Source
pub fn or<'a, V, L, R>(
    left: L,
    right: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, <L::Nullable as Nullability>::Or<R::Nullable>, <L::Aggregate as AggregateKind>::Or<R::Aggregate>, (L::Sources, R::Sources)>
where V: SQLParam + 'a, L: Expr<'a, V>, L::SQLType: BooleanLike, R: Expr<'a, V>, R::SQLType: BooleanLike, R::Nullable: Nullability,
Expand description

Logical OR of two conditions.

Renders (left OR right). Both operands must be boolean. The result is nullable if either operand is, and is an aggregate if either operand is. left | right on an SQLExpr does the same. For more than two conditions, use any.

ยงExamples

let cond = or(eq(users.name, "admin"), eq(users.name, "root"));
assert_eq!(cond.sql(), r#"("users"."name" = ? OR "users"."name" = ?)"#);