Skip to main content

round

Function round 

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

Rounds to the nearest integer (ROUND(expr)).

The argument must be numeric. The result type comes from RoundingPolicy (REAL on SQLite, float8 on PostgreSQL, the matching integer or decimal type on MySQL) and keeps the argument’s nullability.

§Examples

assert_eq!(round(users.score).sql(), r#"ROUND ("users"."score")"#);