[][src]Trait tiberius::FromSql

pub trait FromSql<'a> where
    Self: Sized + 'a, 
{ pub fn from_sql(value: &'a ColumnData<'static>) -> Result<Option<Self>>; }

A conversion trait from a TDS type by-reference.

A FromSql implementation for a Rust type is needed for using it as a return parameter from Row#get or Row#try_get methods. The following Rust types are already implemented to match the given server types:

Rust typeServer type
u8tinyint
i16smallint
i32int
i64bigint
f32float(24)
f64float(53)
boolbit
String/&strnvarchar/varchar/nchar/char/ntext/text
Vec<u8>/&[u8]binary/varbinary/image
Uuiduniqueidentifier
Numericnumeric/decimal
Decimal (with feature flag rust_decimal)numeric/decimal
XmlDataxml
NaiveDateTime (with feature flag chrono)datetime/datetime2/smalldatetime
NaiveDate (with feature flag chrono)date
NaiveTime (with feature flag chrono)time
DateTime (with feature flag chrono)datetimeoffset

See the time module for more information about the date and time structs.

Required methods

pub fn from_sql(value: &'a ColumnData<'static>) -> Result<Option<Self>>[src]

Returns the value, None being a null value, copying the value.

Loading content...

Implementations on Foreign Types

impl<'a> FromSql<'a> for bool[src]

impl<'a> FromSql<'a> for u8[src]

impl<'a> FromSql<'a> for f32[src]

impl<'a> FromSql<'a> for f64[src]

impl<'a> FromSql<'a> for i32[src]

impl<'a> FromSql<'a> for i16[src]

impl<'a> FromSql<'a> for i64[src]

impl<'a> FromSql<'a> for &'a str[src]

impl<'a> FromSql<'a> for &'a [u8][src]

Loading content...

Implementors

impl<'a> FromSql<'a> for &'a XmlData[src]

impl<'a> FromSql<'a> for BigDecimal[src]

impl<'a> FromSql<'a> for Decimal[src]

impl<'a> FromSql<'a> for Numeric[src]

impl<'a> FromSql<'a> for Uuid[src]

impl<'a> FromSql<'a> for DateTime<FixedOffset>[src]

impl<'a> FromSql<'a> for DateTime<Utc>[src]

impl<'a> FromSql<'a> for NaiveDate[src]

impl<'a> FromSql<'a> for NaiveDateTime[src]

impl<'a> FromSql<'a> for NaiveTime[src]

Loading content...