Trait diesel::prelude::FindDsl [] [src]

pub trait FindDsl<PK>: AsQuery {
    type Output: AsQuery<SqlType=Self::SqlType>;
    fn find(self, id: PK) -> Self::Output;
}

Attempts to find a single record from the given table by primary key.

Example

let sean = (1, "Sean".to_string());
let tess = (2, "Tess".to_string());
assert_eq!(Ok(sean), users.find(1).first(&connection));
assert_eq!(Ok(tess), users.find(2).first(&connection));
assert_eq!(Err::<(i32, String), _>(NotFound), users.find(3).first(&connection));

Associated Types

Required Methods

Implementors