Trait diesel::prelude::FirstDsl
[−]
[src]
pub trait FirstDsl<Conn>: LimitDsl + LoadDsl<Conn> { fn first<U>(self, conn: &Conn) -> QueryResult<U>
where
Limit<Self>: LoadQuery<Conn, U>, { ... } }
Provided Methods
fn first<U>(self, conn: &Conn) -> QueryResult<U> where
Limit<Self>: LoadQuery<Conn, U>,
Limit<Self>: LoadQuery<Conn, U>,
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>>
.