pub enum AggregateField {
CountAll,
CountColumn(String),
CountDistinct(String),
Sum(String),
Avg(String),
Min(String),
Max(String),
}Expand description
An aggregation field specifier.
Variants§
CountAll
Count all rows.
CountColumn(String)
Count non-null values in a column.
CountDistinct(String)
Count distinct values in a column.
Sum(String)
Sum of a numeric column.
Avg(String)
Average of a numeric column.
Min(String)
Minimum value in a column.
Max(String)
Maximum value in a column.
Implementations§
Source§impl AggregateField
impl AggregateField
Sourcepub fn to_sql_dialect(&self, dialect: &dyn SqlDialect) -> String
pub fn to_sql_dialect(&self, dialect: &dyn SqlDialect) -> String
Build the SQL expression for this aggregate, quoting the column identifier via the given dialect (backticks on MySQL, brackets on MSSQL, double quotes on Postgres/SQLite).
Sourcepub fn is_count(&self) -> bool
pub fn is_count(&self) -> bool
Whether this aggregate yields an integer count.
COUNT(*), COUNT(col) and COUNT(DISTINCT col) all return SQL
BIGINT/Int8, so a HAVING comparison against one must bind its
threshold as an integer — binding an f64 makes the driver reject
the parameter with a type mismatch (Int8 vs f64). SUM/AVG/
MIN/MAX are value-typed and keep float binding.
Trait Implementations§
Source§impl Clone for AggregateField
impl Clone for AggregateField
Source§fn clone(&self) -> AggregateField
fn clone(&self) -> AggregateField
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AggregateField
impl RefUnwindSafe for AggregateField
impl Send for AggregateField
impl Sync for AggregateField
impl Unpin for AggregateField
impl UnsafeUnpin for AggregateField
impl UnwindSafe for AggregateField
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more