Trait diesel::query_dsl::JoinOnDsl [−][src]
Expand description
Specify the ON
clause for a join statement. This will override
any implicit ON
clause that would come from joinable!
Example
let data = users::table
.left_join(posts::table.on(
users::id.eq(posts::user_id).and(
posts::title.eq("My first post"))
))
.select((users::name, posts::title.nullable()))
.load(&connection);
let expected = vec![
("Sean".to_string(), Some("My first post".to_string())),
("Tess".to_string(), None),
];
assert_eq!(Ok(expected), data);