Skip to main content

RoundingPolicy

Trait RoundingPolicy 

Source
pub trait RoundingPolicy<D>: Numeric {
    type Output: DataType;

    // Provided methods
    fn precision_operand<'a, V: SQLParam + 'a>(expr: SQL<'a, V>) -> SQL<'a, V> { ... }
    fn coerce_result<'a, V: SQLParam + 'a>(sql: SQL<'a, V>) -> SQL<'a, V> { ... }
}

Required Associated Types§

Provided Methods§

Source

fn precision_operand<'a, V: SQLParam + 'a>(expr: SQL<'a, V>) -> SQL<'a, V>

Prepare the operand of ROUND(expr, precision).

PostgreSQL only defines the two-argument ROUND for numeric, and double precision does not cast to it implicitly.

Source

fn coerce_result<'a, V: SQLParam + 'a>(sql: SQL<'a, V>) -> SQL<'a, V>

Coerce a rounding function’s result to Self::Output.

PostgreSQL returns numeric for every rounding function unless the argument is double precision; the declared output is float8.

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 RoundingPolicy<MySQLDialect> for BigInt

Source§

impl RoundingPolicy<MySQLDialect> for BigIntUnsigned

Source§

impl RoundingPolicy<MySQLDialect> for Decimal

Source§

impl RoundingPolicy<MySQLDialect> for Double

Source§

impl RoundingPolicy<MySQLDialect> for Float

Source§

impl RoundingPolicy<MySQLDialect> for Int

Source§

impl RoundingPolicy<MySQLDialect> for IntUnsigned

Source§

impl RoundingPolicy<MySQLDialect> for MediumInt

Source§

impl RoundingPolicy<MySQLDialect> for MediumIntUnsigned

Source§

impl RoundingPolicy<MySQLDialect> for SmallInt

Source§

impl RoundingPolicy<MySQLDialect> for SmallIntUnsigned

Source§

impl RoundingPolicy<MySQLDialect> for TinyInt

Source§

impl RoundingPolicy<MySQLDialect> for TinyIntUnsigned

Source§

impl RoundingPolicy<MySQLDialect> for Year

Source§

impl RoundingPolicy<PostgresDialect> for Float4

Source§

type Output = Float8

Source§

fn precision_operand<'a, V: SQLParam + 'a>(expr: SQL<'a, V>) -> SQL<'a, V>

Source§

fn coerce_result<'a, V: SQLParam + 'a>(sql: SQL<'a, V>) -> SQL<'a, V>

Source§

impl RoundingPolicy<PostgresDialect> for Float8

Source§

type Output = Float8

Source§

fn precision_operand<'a, V: SQLParam + 'a>(expr: SQL<'a, V>) -> SQL<'a, V>

Source§

fn coerce_result<'a, V: SQLParam + 'a>(sql: SQL<'a, V>) -> SQL<'a, V>

Source§

impl RoundingPolicy<PostgresDialect> for Int2

Source§

type Output = Float8

Source§

fn coerce_result<'a, V: SQLParam + 'a>(sql: SQL<'a, V>) -> SQL<'a, V>

Source§

impl RoundingPolicy<PostgresDialect> for Int4

Source§

type Output = Float8

Source§

fn coerce_result<'a, V: SQLParam + 'a>(sql: SQL<'a, V>) -> SQL<'a, V>

Source§

impl RoundingPolicy<PostgresDialect> for Int8

Source§

type Output = Float8

Source§

fn coerce_result<'a, V: SQLParam + 'a>(sql: SQL<'a, V>) -> SQL<'a, V>

Source§

impl RoundingPolicy<PostgresDialect> for Numeric

Source§

type Output = Float8

Source§

fn coerce_result<'a, V: SQLParam + 'a>(sql: SQL<'a, V>) -> SQL<'a, V>

Source§

impl RoundingPolicy<SQLiteDialect> for Integer

Source§

impl RoundingPolicy<SQLiteDialect> for Numeric

Source§

impl RoundingPolicy<SQLiteDialect> for Real

Implementors§