Trait sqlx::Value[][src]

pub trait Value {
    type Database: Database;
    pub fn as_ref(&self) -> <Self::Database as HasValueRef<'_>>::ValueRef;
pub fn type_info(&self) -> Cow<'_, <Self::Database as Database>::TypeInfo>;
pub fn is_null(&self) -> bool; pub fn decode<'r, T>(&'r self) -> T
    where
        T: Decode<'r, Self::Database> + Type<Self::Database>
, { ... }
pub fn decode_unchecked<'r, T>(&'r self) -> T
    where
        T: Decode<'r, Self::Database>
, { ... }
pub fn try_decode<'r, T>(&'r self) -> Result<T, Error>
    where
        T: Decode<'r, Self::Database> + Type<Self::Database>
, { ... }
pub fn try_decode_unchecked<'r, T>(&'r self) -> Result<T, Error>
    where
        T: Decode<'r, Self::Database>
, { ... } }

An owned value from the database.

Associated Types

Loading content...

Required methods

pub fn as_ref(&self) -> <Self::Database as HasValueRef<'_>>::ValueRef[src]

Get this value as a reference.

pub fn type_info(&self) -> Cow<'_, <Self::Database as Database>::TypeInfo>[src]

Get the type information for this value.

pub fn is_null(&self) -> bool[src]

Returns true if the SQL value is NULL.

Loading content...

Provided methods

pub fn decode<'r, T>(&'r self) -> T where
    T: Decode<'r, Self::Database> + Type<Self::Database>, 
[src]

Decode this single value into the requested type.

Panics

Panics if the value cannot be decoded into the requested type. See try_decode for a non-panicking version.

pub fn decode_unchecked<'r, T>(&'r self) -> T where
    T: Decode<'r, Self::Database>, 
[src]

Decode this single value into the requested type.

Unlike decode, this method does not check that the type of this value is compatible with the Rust type and blindly tries to decode the value.

Panics

Panics if the value cannot be decoded into the requested type. See try_decode_unchecked for a non-panicking version.

pub fn try_decode<'r, T>(&'r self) -> Result<T, Error> where
    T: Decode<'r, Self::Database> + Type<Self::Database>, 
[src]

Decode this single value into the requested type.

Errors

  • Decode if the value could not be decoded into the requested type.

pub fn try_decode_unchecked<'r, T>(&'r self) -> Result<T, Error> where
    T: Decode<'r, Self::Database>, 
[src]

Decode this single value into the requested type.

Unlike try_decode, this method does not check that the type of this value is compatible with the Rust type and blindly tries to decode the value.

Errors

  • Decode if the value could not be decoded into the requested type.
Loading content...

Implementors

impl Value for AnyValue[src]

type Database = Any

impl Value for MssqlValue[src]

type Database = Mssql

impl Value for MySqlValue[src]

type Database = MySql

impl Value for PgValue[src]

type Database = Postgres

impl Value for SqliteValue[src]

type Database = Sqlite

Loading content...