Skip to main content

SqlTypeMapping

Trait SqlTypeMapping 

Source
pub trait SqlTypeMapping: Sized {
    const SQL_SERVER_TYPE: SqlServerType;
    const DEFAULT_MAX_LENGTH: Option<u32> = None;
    const DEFAULT_PRECISION: Option<u8> = None;
    const DEFAULT_SCALE: Option<u8> = None;

    // Required methods
    fn to_sql_value(self) -> SqlValue;
    fn from_sql_value(value: SqlValue) -> Result<Self, OrmError>;
}
Expand description

Base Rust <-> SQL Server mapping contract used by row readers and persistence models.

Required Associated Constants§

Provided Associated Constants§

Required Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SqlTypeMapping for bool

Source§

impl SqlTypeMapping for f64

Source§

impl SqlTypeMapping for i32

Source§

impl SqlTypeMapping for i64

Source§

impl SqlTypeMapping for String

Source§

impl SqlTypeMapping for Vec<u8>

Source§

impl SqlTypeMapping for NaiveDate

Source§

impl SqlTypeMapping for NaiveDateTime

Source§

impl SqlTypeMapping for Decimal

Source§

impl SqlTypeMapping for Uuid

Source§

const SQL_SERVER_TYPE: SqlServerType = SqlServerType::UniqueIdentifier

Source§

fn to_sql_value(self) -> SqlValue

Source§

fn from_sql_value(value: SqlValue) -> Result<Uuid, OrmError>

Source§

impl<T> SqlTypeMapping for Option<T>
where T: SqlTypeMapping,

Source§

const SQL_SERVER_TYPE: SqlServerType = T::SQL_SERVER_TYPE

Source§

const DEFAULT_MAX_LENGTH: Option<u32> = T::DEFAULT_MAX_LENGTH

Source§

const DEFAULT_PRECISION: Option<u8> = T::DEFAULT_PRECISION

Source§

const DEFAULT_SCALE: Option<u8> = T::DEFAULT_SCALE

Source§

fn to_sql_value(self) -> SqlValue

Source§

fn from_sql_value(value: SqlValue) -> Result<Option<T>, OrmError>

Implementors§