Trait diesel::LoadDsl
[−]
[src]
pub trait LoadDsl: AsQuery + Sized { fn load<U>(self, conn: &Connection) -> QueryResult<Cursor<Self::SqlType, U>> where U: Queriable<Self::SqlType> { ... } fn first<U>(self, conn: &Connection) -> QueryResult<U> where U: Queriable<Self::Output::SqlType>, Self: LimitDsl { ... } fn get_result<U>(self, conn: &Connection) -> QueryResult<U> where U: Queriable<Self::SqlType> { ... } fn get_results<U>(self, conn: &Connection) -> QueryResult<Cursor<Self::SqlType, U>> where U: Queriable<Self::SqlType> { ... } }
Methods to execute a query given a connection. These are automatically implemented for the various query types.
Provided Methods
fn load<U>(self, conn: &Connection) -> QueryResult<Cursor<Self::SqlType, U>> where U: Queriable<Self::SqlType>
Executes the given query, returning an Iterator
over the returned
rows.
fn first<U>(self, conn: &Connection) -> QueryResult<U> where U: Queriable<Self::Output::SqlType>, Self: LimitDsl
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_result<U>(self, conn: &Connection) -> QueryResult<U> where U: Queriable<Self::SqlType>
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>>
fn get_results<U>(self, conn: &Connection) -> QueryResult<Cursor<Self::SqlType, U>> where U: Queriable<Self::SqlType>
Runs the command, returning an Iterator
over the affected rows.
Implementors
impl<T: AsQuery> LoadDsl for T