Skip to main content

and_

Function and_ 

Source
pub fn and_<T: Clone>(
    lhs: impl Expressive<T>,
    rhs: impl Expressive<T>,
) -> ConditionGroup<T>
Expand description

Joins two conditions with AND: (lhs AND rhs).

with_condition() joins its conditions with AND already. Use and_() when you must make a group inside an or_():

use vantage_sql::primitives::*;

// ((price > 100 AND in_stock = 1) OR featured = 1)
or_(
    and_(ident("price").gt(100), ident("in_stock").eq(true)),
    ident("featured").eq(true),
)