Type Alias diesel::dsl::LeftJoinQuerySource

source ·
pub type LeftJoinQuerySource<Left, Right, On = <Left as JoinTo<Right>>::OnClause> = JoinOn<Join<Left, Right, LeftOuter>, On>;
Expand description

A query source representing the left outer join between two tables.

The third generic type (On) controls how the tables are joined.

By default, the implicit join established by joinable! will be used, allowing you to omit the exact join condition. For example, for the left join between three tables that implement JoinTo, you only need to specify the tables: LeftJoinQuerySource<LeftJoinQuerySource<table1, table2>, table3>.

If you use an explicit ON clause, you will need to specify the On generic type.

use diesel::{dsl, helper_types::LeftJoinQuerySource};
use schema::*;

// If you have an explicit join like this...
let join_constraint = comments::columns::post_id.eq(posts::columns::id);
posts::table.left_join(comments::table.on(join_constraint));

// ... you can use `LeftJoinQuerySource` like this.
type JoinConstraint = dsl::Eq<comments::columns::post_id, posts::columns::id>;
type MyLeftJoinQuerySource = LeftJoinQuerySource<posts::table, comments::table, JoinConstraint>;

Aliased Type§

struct LeftJoinQuerySource<Left, Right, On = <Left as JoinTo<Right>>::OnClause> { /* private fields */ }