Trait diesel::prelude::Queryable

source ·
pub trait Queryable<ST, DB>: Sizedwhere
    DB: Backend,{
    type Row: FromStaticSqlRow<ST, DB>;

    // Required method
    fn build(row: Self::Row) -> Result<Self>;
}
Expand description

Trait indicating that a record can be queried from the database.

Types which implement Queryable represent the result of a SQL query. This does not necessarily mean they represent a single database table.

Diesel represents the return type of a query as a tuple. The purpose of this trait is to convert from a tuple of Rust values that have been deserialized into your struct.

This trait can be derived

How to resolve compiler errors while loading data from the database

In case you getting uncomprehensable compiler errors while loading data from the database you might want to consider using #[derive(Selectable)] + #[diesel(check_for_backend(YourBackendType))] to check for mismatching fields at compile time. This drastically improves the quality of the generated error messages by pointing to concrete mismatches at field level. You need to specify the concrete database backend this specific struct is indented to be used with, as otherwise rustc cannot correctly identify the required deserialization implementation.

Interaction with NULL/Option

Nullable types can be queried into Option. This is valid for single fields, tuples, and structures with Queryable.

With tuples and structs, the process for deserializing an Option<(A,B,C)> is to attempt to deserialize A, B and C, and if either of these return an UnexpectedNullError, the Option will be deserialized as None. If all succeed, the Option will be deserialized as Some((a,b,c)).

Examples

Simple mapping from query to struct

If we just want to map a query to our struct, we can use derive.

#[derive(Queryable, PartialEq, Debug)]
struct User {
    id: i32,
    name: String,
}

let first_user = users.order_by(id).first(connection)?;
let expected = User { id: 1, name: "Sean".into() };
assert_eq!(expected, first_user);

Interaction with NULL/Option

Single field

table! {
    animals {
        id -> Integer,
        species -> VarChar,
        legs -> Integer,
        name -> Nullable<VarChar>,
    }
}
#[derive(Queryable, PartialEq, Debug)]
struct Animal {
    id: i32,
    name: Option<String>,
}

let all_animals = animals.select((id, name)).order_by(id).load(connection)?;
let expected = vec![Animal { id: 1, name: Some("Jack".to_owned()) }, Animal { id: 2, name: None }];
assert_eq!(expected, all_animals);

Multiple fields

#[derive(Queryable, PartialEq, Debug)]
struct UserWithPost {
    id: i32,
    post: Option<Post>,
}
#[derive(Queryable, PartialEq, Debug)]
struct Post {
    id: i32,
    title: String,
}

let all_posts = users::table
    .left_join(posts::table)
    .select((
        users::id,
        (posts::id, posts::title).nullable()
    ))
    .order_by((users::id, posts::id))
    .load(connection)?;
let expected = vec![
    UserWithPost { id: 1, post: Some(Post { id: 1, title: "My first post".to_owned() }) },
    UserWithPost { id: 1, post: Some(Post { id: 2, title: "About Rust".to_owned() }) },
    UserWithPost { id: 2, post: Some(Post { id: 3, title: "My first post too".to_owned() }) },
    UserWithPost { id: 3, post: None },
];
assert_eq!(expected, all_posts);

deserialize_as attribute

If we want to do additional work during deserialization, we can use deserialize_as to use a different implementation.

struct LowercaseString(String);

impl Into<String> for LowercaseString {
    fn into(self) -> String {
        self.0
    }
}

impl<DB> Queryable<Text, DB> for LowercaseString
where
    DB: Backend,
    String: FromSql<Text, DB>,
{
    type Row = String;

    fn build(s: String) -> deserialize::Result<Self> {
        Ok(LowercaseString(s.to_lowercase()))
    }
}

#[derive(Queryable, PartialEq, Debug)]
struct User {
    id: i32,
    #[diesel(deserialize_as = LowercaseString)]
    name: String,
}

let first_user = users.first(connection)?;
let expected = User { id: 1, name: "sean".into() };
assert_eq!(expected, first_user);

Manual implementation

Alternatively, we can implement the trait for our struct manually.

use schema::users;
use diesel::deserialize::{self, Queryable};

type DB = diesel::sqlite::Sqlite;

#[derive(PartialEq, Debug)]
struct User {
    id: i32,
    name: String,
}

impl Queryable<users::SqlType, DB> for User {
    type Row = (i32, String);

    fn build(row: Self::Row) -> deserialize::Result<Self> {
        Ok(User {
            id: row.0,
            name: row.1.to_lowercase(),
        })
    }
}

let first_user = users.first(connection)?;
let expected = User { id: 1, name: "sean".into() };
assert_eq!(expected, first_user);

Required Associated Types§

source

type Row: FromStaticSqlRow<ST, DB>

The Rust type you’d like to map from.

This is typically a tuple of all of your struct’s fields.

Required Methods§

source

fn build(row: Self::Row) -> Result<Self>

Construct an instance of this type

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Queryable<Binary, Mysql> for *const [u8]

Available on crate feature mysql_backend only.
§

type Row = *const [u8]

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl Queryable<Binary, Pg> for *const [u8]

Available on crate feature postgres_backend only.
§

type Row = *const [u8]

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl Queryable<Binary, Sqlite> for *const [u8]

Available on crate feature sqlite only.
§

type Row = *const [u8]

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl Queryable<Text, Mysql> for *const str

Available on crate feature mysql_backend only.
§

type Row = *const str

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl Queryable<Text, Pg> for *const str

Available on crate feature postgres_backend only.
§

type Row = *const str

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl Queryable<Text, Sqlite> for *const str

Available on crate feature sqlite only.
§

type Row = *const str

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<'a, T, ST, DB> Queryable<ST, DB> for Cow<'a, T>where T: 'a + ToOwned + ?Sized, ST: SingleValue, DB: Backend, Self: FromSql<ST, DB>,

§

type Row = Cow<'a, T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<ST, T, DB> Queryable<ST, DB> for Option<T>where ST: SingleValue<IsNull = IsNullable>, DB: Backend, Self: FromSql<ST, DB>,

§

type Row = Option<T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T0, ST0> Queryable<Record<(ST0,)>, Pg> for (T0,)where Self: FromSql<Record<(ST0,)>, Pg>,

Available on crate feature postgres_backend only.
§

type Row = (T0,)

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T0, T1, ST0, ST1> Queryable<Record<(ST0, ST1)>, Pg> for (T0, T1)where Self: FromSql<Record<(ST0, ST1)>, Pg>,

Available on crate feature postgres_backend only.
§

type Row = (T0, T1)

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T0, T1, T2, ST0, ST1, ST2> Queryable<Record<(ST0, ST1, ST2)>, Pg> for (T0, T1, T2)where Self: FromSql<Record<(ST0, ST1, ST2)>, Pg>,

Available on crate feature postgres_backend only.
§

type Row = (T0, T1, T2)

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T0, T1, T2, T3, ST0, ST1, ST2, ST3> Queryable<Record<(ST0, ST1, ST2, ST3)>, Pg> for (T0, T1, T2, T3)where Self: FromSql<Record<(ST0, ST1, ST2, ST3)>, Pg>,

Available on crate feature postgres_backend only.
§

type Row = (T0, T1, T2, T3)

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T0, T1, T2, T3, T4, ST0, ST1, ST2, ST3, ST4> Queryable<Record<(ST0, ST1, ST2, ST3, ST4)>, Pg> for (T0, T1, T2, T3, T4)where Self: FromSql<Record<(ST0, ST1, ST2, ST3, ST4)>, Pg>,

Available on crate feature postgres_backend only.
§

type Row = (T0, T1, T2, T3, T4)

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T0, T1, T2, T3, T4, T5, ST0, ST1, ST2, ST3, ST4, ST5> Queryable<Record<(ST0, ST1, ST2, ST3, ST4, ST5)>, Pg> for (T0, T1, T2, T3, T4, T5)where Self: FromSql<Record<(ST0, ST1, ST2, ST3, ST4, ST5)>, Pg>,

Available on crate feature postgres_backend only.
§

type Row = (T0, T1, T2, T3, T4, T5)

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T0, T1, T2, T3, T4, T5, T6, ST0, ST1, ST2, ST3, ST4, ST5, ST6> Queryable<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6)>, Pg> for (T0, T1, T2, T3, T4, T5, T6)where Self: FromSql<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6)>, Pg>,

Available on crate feature postgres_backend only.
source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7> Queryable<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7)>, Pg> for (T0, T1, T2, T3, T4, T5, T6, T7)where Self: FromSql<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7)>, Pg>,

Available on crate feature postgres_backend only.
source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8> Queryable<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8)>, Pg> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)where Self: FromSql<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8)>, Pg>,

Available on crate feature postgres_backend only.
source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9> Queryable<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9)>, Pg> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)where Self: FromSql<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9)>, Pg>,

Available on crate feature postgres_backend only.
source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10> Queryable<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10)>, Pg> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)where Self: FromSql<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10)>, Pg>,

Available on crate feature postgres_backend only.
source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11> Queryable<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11)>, Pg> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)where Self: FromSql<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11)>, Pg>,

Available on crate feature postgres_backend only.
source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12> Queryable<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12)>, Pg> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)where Self: FromSql<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12)>, Pg>,

Available on crate feature postgres_backend only.
source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13> Queryable<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13)>, Pg> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)where Self: FromSql<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13)>, Pg>,

Available on crate feature postgres_backend only.
source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14> Queryable<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14)>, Pg> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)where Self: FromSql<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14)>, Pg>,

Available on crate feature postgres_backend only.
source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14, ST15> Queryable<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14, ST15)>, Pg> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)where Self: FromSql<Record<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14, ST15)>, Pg>,

Available on crate feature postgres_backend only.
source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14, ST15> Queryable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14, ST15), __DB> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14, ST15), __DB>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14> Queryable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14), __DB> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14), __DB>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13> Queryable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13), __DB> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13), __DB>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12> Queryable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12), __DB> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12), __DB>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11> Queryable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11), __DB> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11), __DB>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10> Queryable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10), __DB> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10), __DB>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9> Queryable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9), __DB> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9), __DB>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8> Queryable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8), __DB> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8), __DB>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7> Queryable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7), __DB> for (T0, T1, T2, T3, T4, T5, T6, T7)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7), __DB>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6> Queryable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6), __DB> for (T0, T1, T2, T3, T4, T5, T6)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3, ST4, ST5, ST6), __DB>,

source§

impl<T0, T1, T2, T3, T4, T5, __DB, ST0, ST1, ST2, ST3, ST4, ST5> Queryable<(ST0, ST1, ST2, ST3, ST4, ST5), __DB> for (T0, T1, T2, T3, T4, T5)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3, ST4, ST5), __DB>,

§

type Row = (T0, T1, T2, T3, T4, T5)

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T0, T1, T2, T3, T4, __DB, ST0, ST1, ST2, ST3, ST4> Queryable<(ST0, ST1, ST2, ST3, ST4), __DB> for (T0, T1, T2, T3, T4)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3, ST4), __DB>,

§

type Row = (T0, T1, T2, T3, T4)

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T0, T1, T2, T3, __DB, ST0, ST1, ST2, ST3> Queryable<(ST0, ST1, ST2, ST3), __DB> for (T0, T1, T2, T3)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2, ST3), __DB>,

§

type Row = (T0, T1, T2, T3)

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T0, T1, T2, __DB, ST0, ST1, ST2> Queryable<(ST0, ST1, ST2), __DB> for (T0, T1, T2)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1, ST2), __DB>,

§

type Row = (T0, T1, T2)

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T0, T1, __DB, ST0, ST1> Queryable<(ST0, ST1), __DB> for (T0, T1)where __DB: Backend, Self: FromStaticSqlRow<(ST0, ST1), __DB>,

§

type Row = (T0, T1)

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T0, __DB, ST0> Queryable<(ST0,), __DB> for (T0,)where __DB: Backend, Self: FromStaticSqlRow<(ST0,), __DB>,

§

type Row = (T0,)

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<T, ST> Queryable<Range<ST>, Pg> for (Bound<T>, Bound<T>)where T: FromSql<ST, Pg>,

Available on crate feature postgres_backend only.
§

type Row = (Bound<T>, Bound<T>)

source§

fn build(row: Self) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for IpNetworkwhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate features network-address and postgres_backend only.
§

type Row = IpNetwork

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for Valuewhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature serde_json and (crate features postgres_backend or mysql_backend) only.
§

type Row = Value

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for boolwhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = bool

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for f32where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = f32

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for f64where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = f64

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for i8where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = i8

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for i16where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = i16

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for i32where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = i32

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for i64where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = i64

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for u8where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = u8

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for u16where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = u16

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for u32where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = u32

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for u64where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = u64

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for Stringwhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = String

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for SystemTimewhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = SystemTime

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for BigDecimalwhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature bigdecimal only.
§

type Row = BigDecimal

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for NaiveDatewhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature chrono only.
§

type Row = NaiveDate

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for NaiveDateTimewhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature chrono only.
§

type Row = NaiveDateTime

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for NaiveTimewhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature chrono only.
§

type Row = NaiveTime

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for NaiveDatewhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature time only.
§

type Row = Date

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for OffsetDateTimewhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature time only.
§

type Row = OffsetDateTime

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for PrimitiveDateTimewhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature time only.
§

type Row = PrimitiveDateTime

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for NaiveTimewhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature time only.
§

type Row = Time

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for Uuidwhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate features uuid and postgres_backend only.
§

type Row = Uuid

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB> Queryable<__ST, __DB> for [u8; 6]where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature postgres_backend only.
§

type Row = [u8; 6]

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB, T> Queryable<__ST, __DB> for Vec<T>where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

§

type Row = Vec<T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__ST, __DB, Tz: TimeZone> Queryable<__ST, __DB> for DateTime<Tz>where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature chrono only.
§

type Row = DateTime<Tz>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0> Queryable<Nullable<(ST0,)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0,)>, __DB>, (ST0,): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1> Queryable<Nullable<(ST0, ST1)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1)>, __DB>, (ST0, ST1): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2> Queryable<Nullable<(ST0, ST1, ST2)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2)>, __DB>, (ST0, ST1, ST2): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3> Queryable<Nullable<(ST0, ST1, ST2, ST3)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3)>, __DB>, (ST0, ST1, ST2, ST3): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3, ST4> Queryable<Nullable<(ST0, ST1, ST2, ST3, ST4)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3, ST4)>, __DB>, (ST0, ST1, ST2, ST3, ST4): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3, ST4, ST5> Queryable<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5)>, __DB>, (ST0, ST1, ST2, ST3, ST4, ST5): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6> Queryable<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6)>, __DB>, (ST0, ST1, ST2, ST3, ST4, ST5, ST6): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7> Queryable<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7)>, __DB>, (ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8> Queryable<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8)>, __DB>, (ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9> Queryable<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9)>, __DB>, (ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10> Queryable<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10)>, __DB>, (ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11> Queryable<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11)>, __DB>, (ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12> Queryable<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12)>, __DB>, (ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13> Queryable<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13)>, __DB>, (ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14> Queryable<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14)>, __DB>, (ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

source§

impl<__T, __DB, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14, ST15> Queryable<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14, ST15)>, __DB> for Option<__T>where __DB: Backend, Self: FromStaticSqlRow<Nullable<(ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14, ST15)>, __DB>, (ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8, ST9, ST10, ST11, ST12, ST13, ST14, ST15): SqlType,

§

type Row = Option<__T>

source§

fn build(row: Self::Row) -> Result<Self>

Implementors§

source§

impl<'a, __ST, __DB> Queryable<__ST, __DB> for MigrationVersion<'a>where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

source§

impl<__ST, __DB> Queryable<__ST, __DB> for PgNumericwhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature postgres_backend only.
source§

impl<__ST, __DB> Queryable<__ST, __DB> for MysqlTimewhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature mysql_backend only.
source§

impl<__ST, __DB> Queryable<__ST, __DB> for PgDatewhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature postgres_backend only.
§

type Row = PgDate

source§

impl<__ST, __DB> Queryable<__ST, __DB> for PgIntervalwhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature postgres_backend only.
source§

impl<__ST, __DB> Queryable<__ST, __DB> for PgMoneywhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature postgres_backend only.
§

type Row = PgMoney

source§

impl<__ST, __DB> Queryable<__ST, __DB> for PgTimewhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature postgres_backend only.
§

type Row = PgTime

source§

impl<__ST, __DB> Queryable<__ST, __DB> for PgTimestampwhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Available on crate feature postgres_backend only.