Skip to main content

AggregatePolicy

Trait AggregatePolicy 

Source
pub trait AggregatePolicy<D>: Numeric {
    type Sum: DataType;
    type Avg: DataType;
}
Expand description

Result types of sum and avg for a numeric SQL type on dialect D.

DialectInputSUMAVG
SQLiteINTEGERINTEGERREAL
SQLiteREALREALREAL
SQLiteNUMERIC, ANYsame as inputREAL
PostgreSQLint2, int4int8float8
PostgreSQLint8int8float8
PostgreSQLfloat4, float8float8float8
PostgreSQLnumericnumericnumeric
MySQLinteger types, DECIMALDECIMALDECIMAL
MySQLFLOAT, DOUBLEDOUBLEDOUBLE

These are the declared types; the SQL is not cast. PostgreSQL itself returns numeric for AVG of an integer type and for SUM of int8, and real for SUM of float4, so wrap such a result in cast before decoding it.

Required Associated Types§

Source

type Sum: DataType

Result type of SUM.

Source

type Avg: DataType

Result type of AVG.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AggregatePolicy<MySQLDialect> for BigInt

Source§

impl AggregatePolicy<MySQLDialect> for BigIntUnsigned

Source§

impl AggregatePolicy<MySQLDialect> for Decimal

Source§

impl AggregatePolicy<MySQLDialect> for Double

Source§

impl AggregatePolicy<MySQLDialect> for Float

Source§

impl AggregatePolicy<MySQLDialect> for Int

Source§

impl AggregatePolicy<MySQLDialect> for IntUnsigned

Source§

impl AggregatePolicy<MySQLDialect> for MediumInt

Source§

impl AggregatePolicy<MySQLDialect> for MediumIntUnsigned

Source§

impl AggregatePolicy<MySQLDialect> for SmallInt

Source§

impl AggregatePolicy<MySQLDialect> for SmallIntUnsigned

Source§

impl AggregatePolicy<MySQLDialect> for TinyInt

Source§

impl AggregatePolicy<MySQLDialect> for TinyIntUnsigned

Source§

impl AggregatePolicy<MySQLDialect> for Year

Source§

impl AggregatePolicy<PostgresDialect> for Float4

Source§

impl AggregatePolicy<PostgresDialect> for Float8

Source§

impl AggregatePolicy<PostgresDialect> for Int2

Source§

impl AggregatePolicy<PostgresDialect> for Int4

Source§

impl AggregatePolicy<PostgresDialect> for Int8

Source§

impl AggregatePolicy<PostgresDialect> for Numeric

Source§

impl AggregatePolicy<SQLiteDialect> for Any

Source§

impl AggregatePolicy<SQLiteDialect> for Integer

Source§

impl AggregatePolicy<SQLiteDialect> for Numeric

Source§

impl AggregatePolicy<SQLiteDialect> for Real

Implementors§