Trait diesel::prelude::LoadDsl [] [src]

pub trait LoadDsl<Conn: Connection>: AsQuery + Sized where Conn::Backend: HasSqlType<Self::SqlType> {
    fn load<'a, U>(self, conn: &Conn) -> QueryResult<Vec<U>> where U: Queryable<Self::SqlType, Conn::Backend> + 'a;
    fn get_result<U>(self, conn: &Conn) -> QueryResult<U> where U: Queryable<Self::SqlType, Conn::Backend>;

    fn first<U>(self, conn: &Conn) -> QueryResult<U> where Self: LimitDsl, Limit<Self>: LoadDsl<Conn, SqlType=Self::SqlType>, U: Queryable<Self::SqlType, Conn::Backend> { ... }
    fn get_results<'a, U>(self, conn: &Conn) -> QueryResult<Vec<U>> where U: Queryable<Self::SqlType, Conn::Backend> + 'a { ... }
}

Methods to execute a query given a connection. These are automatically implemented for the various query types.

Required Methods

fn load<'a, U>(self, conn: &Conn) -> QueryResult<Vec<U>> where U: Queryable<Self::SqlType, Conn::Backend> + 'a

Executes the given query, returning an Iterator over the returned rows.

fn get_result<U>(self, conn: &Conn) -> QueryResult<U> where U: Queryable<Self::SqlType, Conn::Backend>

Runs the command, and returns the affected row. Err(NotFound) will be returned if the query affected 0 rows. You can call .optional() on the result of this if the command was optional to get back a Result<Option<U>>

Provided Methods

fn first<U>(self, conn: &Conn) -> QueryResult<U> where Self: LimitDsl, Limit<Self>: LoadDsl<Conn, SqlType=Self::SqlType>, U: Queryable<Self::SqlType, Conn::Backend>

Attempts to load a single record. Returns Ok(record) if found, and Err(NotFound) if no results are returned. If the query truly is optional, you can call .optional() on the result of this to get a Result<Option<U>>.

fn get_results<'a, U>(self, conn: &Conn) -> QueryResult<Vec<U>> where U: Queryable<Self::SqlType, Conn::Backend> + 'a

Runs the command, returning an Iterator over the affected rows.

Implementors