avg

Function avg 

Source
pub fn avg<'a, V, E>(expr: E) -> SQLExpr<'a, V, Double, Null, Agg>
where V: SQLParam + 'a, E: Expr<'a, V>, E::SQLType: Numeric,
Expand description

AVG(expr) - calculates average of numeric values.

Requires the expression to be Numeric. Always returns Double (SQL standard behavior), nullable.

ยงType Safety

โ“˜
// โœ… OK: Numeric column
avg(products.price);

// โŒ Compile error: Text is not Numeric
avg(users.name);