Skip to main content

eq

Function eq 

Source
pub fn eq<'a, V, L, R>(
    left: L,
    right: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <L::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, L>>::Aggregate>, (Arg<<L as Expr<'a, V>>::Nullable, <L as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, L>>::Nullable, <R as ComparisonOperand<'a, V, L>>::Sources>)>
where V: SQLParam + 'a, L: Expr<'a, V>, R: ComparisonOperand<'a, V, L>, L::SQLType: Compatible<<R as ComparisonOperand<'a, V, L>>::SQLType>,
Expand description

Equality comparison (=).

Renders left = right. Both sides must have compatible SQL types. The result is the dialect’s boolean. It is NULL when either side is, and an aggregate when either side is.

§Examples

let by_id = eq(users.id, 42);
assert_eq!(by_id.sql(), r#""users"."id" = ?"#);

§Type safety

Comparing an integer column with text does not compile:

ⓘ
let wrong = eq(users.id, "hello");