sea_orm

Trait TryGetableMany

Source
pub trait TryGetableMany: Sized {
    // Required methods
    fn try_get_many(
        res: &QueryResult,
        pre: &str,
        cols: &[String],
    ) -> Result<Self, TryGetError>;
    fn try_get_many_by_index(res: &QueryResult) -> Result<Self, TryGetError>;

    // Provided method
    fn find_by_statement<C>(
        stmt: Statement,
    ) -> SelectorRaw<SelectGetableValue<Self, C>>
       where C: IntoEnumIterator + Iden { ... }
}
Expand description

An interface to get a tuple value from the query result

Required Methodsยง

Source

fn try_get_many( res: &QueryResult, pre: &str, cols: &[String], ) -> Result<Self, TryGetError>

Get a tuple value from the query result with prefixed column name

Source

fn try_get_many_by_index(res: &QueryResult) -> Result<Self, TryGetError>

Get a tuple value from the query result based on the order in the select expressions

Provided Methodsยง

Source

fn find_by_statement<C>( stmt: Statement, ) -> SelectorRaw<SelectGetableValue<Self, C>>

use sea_orm::{entity::*, query::*, tests_cfg::cake, DeriveIden, EnumIter, TryGetableMany};

#[derive(EnumIter, DeriveIden)]
enum ResultCol {
    Name,
    NumOfCakes,
}

let res: Vec<(String, i32)> =
    <(String, i32)>::find_by_statement::<ResultCol>(Statement::from_sql_and_values(
        DbBackend::Postgres,
        r#"SELECT "cake"."name", count("cake"."id") AS "num_of_cakes" FROM "cake""#,
        [],
    ))
    .all(&db)
    .await?;

assert_eq!(
    res,
    [
        ("Chocolate Forest".to_owned(), 1),
        ("New York Cheese".to_owned(), 1),
    ]
);

assert_eq!(
    db.into_transaction_log(),
    [Transaction::from_sql_and_values(
        DbBackend::Postgres,
        r#"SELECT "cake"."name", count("cake"."id") AS "num_of_cakes" FROM "cake""#,
        []
    ),]
);

Dyn Compatibilityยง

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Typesยง

Sourceยง

impl<T0, T1> TryGetableMany for (T0, T1)
where T0: TryGetable, T1: TryGetable,

Sourceยง

impl<T0, T1, T2> TryGetableMany for (T0, T1, T2)
where T0: TryGetable, T1: TryGetable, T2: TryGetable,

Sourceยง

impl<T0, T1, T2, T3> TryGetableMany for (T0, T1, T2, T3)
where T0: TryGetable, T1: TryGetable, T2: TryGetable, T3: TryGetable,

Sourceยง

impl<T0, T1, T2, T3, T4> TryGetableMany for (T0, T1, T2, T3, T4)
where T0: TryGetable, T1: TryGetable, T2: TryGetable, T3: TryGetable, T4: TryGetable,

Sourceยง

impl<T0, T1, T2, T3, T4, T5> TryGetableMany for (T0, T1, T2, T3, T4, T5)
where T0: TryGetable, T1: TryGetable, T2: TryGetable, T3: TryGetable, T4: TryGetable, T5: TryGetable,

Sourceยง

impl<T0, T1, T2, T3, T4, T5, T6> TryGetableMany for (T0, T1, T2, T3, T4, T5, T6)
where T0: TryGetable, T1: TryGetable, T2: TryGetable, T3: TryGetable, T4: TryGetable, T5: TryGetable, T6: TryGetable,

Sourceยง

impl<T0, T1, T2, T3, T4, T5, T6, T7> TryGetableMany for (T0, T1, T2, T3, T4, T5, T6, T7)

Sourceยง

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> TryGetableMany for (T0, T1, T2, T3, T4, T5, T6, T7, T8)

Sourceยง

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> TryGetableMany for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Sourceยง

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> TryGetableMany for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Sourceยง

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> TryGetableMany for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

Sourceยง

impl<T> TryGetableMany for (T,)
where T: TryGetableMany,

Implementorsยง

Sourceยง

impl<T> TryGetableMany for T
where T: TryGetable,