pub fn nullif<'a, V, E1, E2>(
expr1: E1,
expr2: E2,
) -> SQLExpr<'a, V, E1::SQLType, Null, <E1::Aggregate as AggregateKind>::Or<E2::Aggregate>, (E1::Sources, E2::Sources)>where
V: SQLParam + 'a,
E1: Expr<'a, V>,
E2: Expr<'a, V>,
E1::SQLType: Compatible<E2::SQLType>,
E2::Aggregate: AggregateKind,Expand description
NULL when two values are equal, otherwise the first (NULLIF(a, b)).
Both arguments must have compatible SQL types. The result has the first argument’s type and is always nullable.
§Examples
// Treat empty names as missing.
let name = nullif(users.name, "");
assert_eq!(name.sql(), r#"NULLIF ("users"."name", ?)"#);