mod_

Function mod_ 

Source
pub fn mod_<'a, V, E1, E2>(
    dividend: E1,
    divisor: E2,
) -> SQLExpr<'a, V, E1::SQLType, <E1::Nullable as NullOr<E2::Nullable>>::Output, Scalar>
where V: SQLParam + 'a, E1: Expr<'a, V>, E1::SQLType: Numeric, E2: Expr<'a, V>, E2::SQLType: Numeric, E1::Nullable: NullOr<E2::Nullable>, E2::Nullable: Nullability,
Expand description

MOD - returns the remainder of division (using % operator).

Returns the same type as the dividend. The result is nullable if either input is nullable. Named mod_ to avoid conflict with Rust’s mod keyword.

Note: Uses the % operator which works on both SQLite and PostgreSQL.

§Example

use drizzle_core::expr::mod_;

// SELECT users.value % 3
let remainder = mod_(users.value, 3);