[−][src]Trait diesel::deserialize::FromSql
Deserialize a single field of a given SQL type.
When possible, implementations of this trait should prefer to use an
existing implementation, rather than reading from bytes
. (For example, if
you are implementing this for an enum which is represented as an integer in
the database, prefer i32::from_sql(bytes)
over reading from bytes
directly)
Types which implement this trait should also have #[derive(FromSqlRow)]
Backend specific details
- For PostgreSQL, the bytes will be sent using the binary protocol, not text.
- For SQLite, the actual type of
DB::RawValue
is private API. All implementations of this trait must be written in terms of an existing primitive. - For MySQL, the value of
bytes
will depend on the return value oftype_metadata
for the given SQL type. SeeMysqlType
for details. - For third party backends, consult that backend's documentation.
Required Methods
Implementations on Foreign Types
impl FromSql<Date, Sqlite> for NaiveDate
[src]
impl FromSql<Date, Sqlite> for NaiveDate
impl FromSql<Time, Sqlite> for NaiveTime
[src]
impl FromSql<Time, Sqlite> for NaiveTime
impl FromSql<Timestamp, Sqlite> for NaiveDateTime
[src]
impl FromSql<Timestamp, Sqlite> for NaiveDateTime
impl FromSql<Date, Sqlite> for *const str
[src]
impl FromSql<Date, Sqlite> for *const str
The returned pointer is only valid for the lifetime to the argument of
from_sql
. This impl is intended for uses where you want to write a new
impl in terms of String
, but don't want to allocate. We have to return a
raw pointer instead of a reference with a lifetime due to the structure of
FromSql
impl FromSql<Time, Sqlite> for *const str
[src]
impl FromSql<Time, Sqlite> for *const str
The returned pointer is only valid for the lifetime to the argument of
from_sql
. This impl is intended for uses where you want to write a new
impl in terms of String
, but don't want to allocate. We have to return a
raw pointer instead of a reference with a lifetime due to the structure of
FromSql
impl FromSql<Timestamp, Sqlite> for *const str
[src]
impl FromSql<Timestamp, Sqlite> for *const str
The returned pointer is only valid for the lifetime to the argument of
from_sql
. This impl is intended for uses where you want to write a new
impl in terms of String
, but don't want to allocate. We have to return a
raw pointer instead of a reference with a lifetime due to the structure of
FromSql
impl FromSql<Text, Sqlite> for *const str
[src]
impl FromSql<Text, Sqlite> for *const str
The returned pointer is only valid for the lifetime to the argument of
from_sql
. This impl is intended for uses where you want to write a new
impl in terms of String
, but don't want to allocate. We have to return a
raw pointer instead of a reference with a lifetime due to the structure of
FromSql
impl FromSql<Binary, Sqlite> for *const [u8]
[src]
impl FromSql<Binary, Sqlite> for *const [u8]
The returned pointer is only valid for the lifetime to the argument of
from_sql
. This impl is intended for uses where you want to write a new
impl in terms of Vec<u8>
, but don't want to allocate. We have to return a
raw pointer instead of a reference with a lifetime due to the structure of
FromSql
impl FromSql<SmallInt, Sqlite> for i16
[src]
impl FromSql<SmallInt, Sqlite> for i16
impl FromSql<Integer, Sqlite> for i32
[src]
impl FromSql<Integer, Sqlite> for i32
impl FromSql<Bool, Sqlite> for bool
[src]
impl FromSql<Bool, Sqlite> for bool
impl FromSql<BigInt, Sqlite> for i64
[src]
impl FromSql<BigInt, Sqlite> for i64
impl FromSql<Float, Sqlite> for f32
[src]
impl FromSql<Float, Sqlite> for f32
impl FromSql<Double, Sqlite> for f64
[src]
impl FromSql<Double, Sqlite> for f64
impl<DB: Backend<RawValue = [u8]>> FromSql<Float, DB> for f32
[src]
impl<DB: Backend<RawValue = [u8]>> FromSql<Float, DB> for f32
impl<DB: Backend<RawValue = [u8]>> FromSql<Double, DB> for f64
[src]
impl<DB: Backend<RawValue = [u8]>> FromSql<Double, DB> for f64
impl<DB: Backend<RawValue = [u8]>> FromSql<SmallInt, DB> for i16
[src]
impl<DB: Backend<RawValue = [u8]>> FromSql<SmallInt, DB> for i16
impl<DB: Backend<RawValue = [u8]>> FromSql<Integer, DB> for i32
[src]
impl<DB: Backend<RawValue = [u8]>> FromSql<Integer, DB> for i32
impl<DB: Backend<RawValue = [u8]>> FromSql<BigInt, DB> for i64
[src]
impl<DB: Backend<RawValue = [u8]>> FromSql<BigInt, DB> for i64
impl<T, ST, DB> FromSql<Nullable<ST>, DB> for Option<T> where
T: FromSql<ST, DB>,
DB: Backend,
ST: NotNull,
[src]
impl<T, ST, DB> FromSql<Nullable<ST>, DB> for Option<T> where
T: FromSql<ST, DB>,
DB: Backend,
ST: NotNull,
impl<ST, DB> FromSql<ST, DB> for String where
DB: Backend,
*const str: FromSql<ST, DB>,
[src]
impl<ST, DB> FromSql<ST, DB> for String where
DB: Backend,
*const str: FromSql<ST, DB>,
impl<DB: Backend<RawValue = [u8]>> FromSql<Text, DB> for *const str
[src]
impl<DB: Backend<RawValue = [u8]>> FromSql<Text, DB> for *const str
The returned pointer is only valid for the lifetime to the argument of
from_sql
. This impl is intended for uses where you want to write a new
impl in terms of String
, but don't want to allocate. We have to return a
raw pointer instead of a reference with a lifetime due to the structure of
FromSql
impl<ST, DB> FromSql<ST, DB> for Vec<u8> where
DB: Backend,
*const [u8]: FromSql<ST, DB>,
[src]
impl<ST, DB> FromSql<ST, DB> for Vec<u8> where
DB: Backend,
*const [u8]: FromSql<ST, DB>,
impl<DB: Backend<RawValue = [u8]>> FromSql<Binary, DB> for *const [u8]
[src]
impl<DB: Backend<RawValue = [u8]>> FromSql<Binary, DB> for *const [u8]
The returned pointer is only valid for the lifetime to the argument of
from_sql
. This impl is intended for uses where you want to write a new
impl in terms of Vec<u8>
, but don't want to allocate. We have to return a
raw pointer instead of a reference with a lifetime due to the structure of
FromSql
impl<'a, T: ?Sized, ST, DB> FromSql<ST, DB> for Cow<'a, T> where
T: 'a + ToOwned,
DB: Backend,
T::Owned: FromSql<ST, DB>,
[src]
impl<'a, T: ?Sized, ST, DB> FromSql<ST, DB> for Cow<'a, T> where
T: 'a + ToOwned,
DB: Backend,
T::Owned: FromSql<ST, DB>,