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

pub trait FindDsl<PK> where Self: Table + FilterDsl<Eq<Self::PrimaryKey, PK>>, PK: AsExpression<Self::PrimaryKey::SqlType>, Eq<Self::PrimaryKey, PK>: SelectableExpression<Self, SqlType=Bool> + NonAggregate {
    fn find(self, id: PK) -> FindBy<Self, Self::PrimaryKey, PK> { ... }
}

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));

Provided Methods

fn find(self, id: PK) -> FindBy<Self, Self::PrimaryKey, PK>

Implementors