Skip to main content

between

Function between 

Source
pub fn between<'a, V, E, L, H>(
    expr: E,
    low: L,
    high: H,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <<E::Aggregate as AggregateKind>::Or<<L as ComparisonOperand<'a, V, E>>::Aggregate> as AggregateKind>::Or<<H as ComparisonOperand<'a, V, E>>::Aggregate>, (Arg<<E as Expr<'a, V>>::Nullable, <E as ExprSources>::Sources>, (Arg<<L as ComparisonOperand<'a, V, E>>::Nullable, <L as ComparisonOperand<'a, V, E>>::Sources>, Arg<<H as ComparisonOperand<'a, V, E>>::Nullable, <H as ComparisonOperand<'a, V, E>>::Sources>))>
where V: SQLParam + 'a, E: Expr<'a, V>, L: ComparisonOperand<'a, V, E>, H: ComparisonOperand<'a, V, E>, E::SQLType: Compatible<<L as ComparisonOperand<'a, V, E>>::SQLType> + Compatible<<H as ComparisonOperand<'a, V, E>>::SQLType>,
Expand description

Range check (BETWEEN), inclusive on both ends.

Renders (expr BETWEEN low AND high). Both bounds must have a SQL type compatible with expr. The result is the dialect’s boolean, NULL when any operand is.

§Examples

let working_age = between(users.age, 18, 65);
assert_eq!(working_age.sql(), r#"("users"."age" BETWEEN ? AND ?)"#);