Trait butane_core::sqlval::FromSql
source · 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§
sourcefn from_sql_ref(val: SqlValRef<'_>) -> Result<Self>where
Self: Sized,
fn from_sql_ref(val: SqlValRef<'_>) -> Result<Self>where Self: Sized,
Used to convert a SqlValRef into another type.
Provided Methods§
sourcefn from_sql(val: SqlVal) -> Result<Self>where
Self: Sized,
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.