Skip to main content

trunc

Function trunc 

Source
pub fn trunc<'a, V, E>(
    expr: E,
) -> SQLExpr<'a, V, <E::SQLType as RoundingPolicy<V::DialectMarker>>::Output, E::Nullable, E::Aggregate>
where V: SQLParam + 'a, V::DialectMarker: MathExt, E: Expr<'a, V>, E::SQLType: RoundingPolicy<V::DialectMarker>,
Expand description

TRUNC - truncates a number towards zero.

Returns a dialect-aware float type, preserves nullability.

ยงExample

use drizzle_core::expr::trunc;

// SELECT TRUNC(users.price), or TRUNCATE(users.price, 0) on MySQL
let truncated = trunc(users.price);