pub trait FromSql {
    // Required method
    fn from_sql_ref(val: SqlValRef<'_>) -> Result<Self>
       where Self: Sized;

    // Provided method
    fn from_sql(val: SqlVal) -> Result<Self>
       where Self: Sized { ... }
}
Expand description

Used to convert a SqlVal or SqlValRef into another type.

The SqlVal is consumed.

Required Methods§

source

fn from_sql_ref(val: SqlValRef<'_>) -> Result<Self>where Self: Sized,

Used to convert a SqlValRef into another type.

Provided Methods§

source

fn from_sql(val: SqlVal) -> Result<Self>where Self: Sized,

Used to convert a SqlVal into another type. The default implementation calls Self::from_sql_ref(val.as_ref()), which may be inefficient. This method is chiefly used only for primary keys: a more efficient implementation is unlikely to provide benefits for types not used as primary keys.

Implementations on Foreign Types§

source§

impl FromSql for i32

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

fn from_sql(val: SqlVal) -> Result<Self>

source§

impl FromSql for String

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

fn from_sql(val: SqlVal) -> Result<Self>

source§

impl FromSql for u16

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

fn from_sql(val: SqlVal) -> Result<Self>

source§

impl FromSql for Vec<u8>

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

fn from_sql(val: SqlVal) -> Result<Self>

source§

impl FromSql for i8

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

fn from_sql(val: SqlVal) -> Result<Self>

source§

impl FromSql for u32

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

fn from_sql(val: SqlVal) -> Result<Self>

source§

impl FromSql for i64

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

fn from_sql(val: SqlVal) -> Result<Self>

source§

impl FromSql for u8

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

fn from_sql(val: SqlVal) -> Result<Self>

source§

impl FromSql for f32

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

fn from_sql(val: SqlVal) -> Result<Self>

source§

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

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

impl FromSql for i16

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

fn from_sql(val: SqlVal) -> Result<Self>

source§

impl FromSql for bool

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

fn from_sql(val: SqlVal) -> Result<Self>

source§

impl FromSql for f64

source§

fn from_sql_ref(valref: SqlValRef<'_>) -> Result<Self>

source§

fn from_sql(val: SqlVal) -> Result<Self>

Implementors§

source§

impl<T> FromSql for ForeignKey<T>where T: DataObject,