Function diesel::expression::dsl::avg [] [src]

pub fn avg<ST, T>(t: T) -> Avg<T> where
    ST: Foldable,
    T: Expression<SqlType = ST>, 

Represents a SQL AVG function. This function can only take types which are Foldable.

Examples

// assert_eq!(Ok(Some(6f64)), animals.select(avg(legs)).first(&connection));
// TODO: There doesn't currently seem to be a way to use avg with integers, since
// they return a `Numeric` which doesn't have a corresponding Rust type.