pub struct JoinChain { /* private fields */ }Expand description
A join under construction.
ON and USING are alternatives and NATURAL excludes both; nothing enforces
that here, because the caller picks one method and the grammar is what says so.
Implementations§
Source§impl JoinChain
impl JoinChain
Sourcepub fn as_(self, alias: impl Into<Cow<'static, str>>) -> JoinChain
pub fn as_(self, alias: impl Into<Cow<'static, str>>) -> JoinChain
AS "alias" on the joined table.
Sourcepub fn columns(
self,
columns: impl IntoIterator<Item = impl Into<Cow<'static, str>>>,
) -> JoinChain
pub fn columns( self, columns: impl IntoIterator<Item = impl Into<Cow<'static, str>>>, ) -> JoinChain
Column aliases on the joined table.
Sourcepub fn lateral(self) -> JoinChain
pub fn lateral(self) -> JoinChain
LATERAL on the joined item — which is what lets a joined sub-query see
the columns of the item it is joined to.
Only grammatical in front of a sub-query or function item; on a bare
table or CTE name this records a build() error instead, because
JOIN LATERAL "posts" is a syntax error with nothing to mean.
Sourcepub fn with_ordinality(self) -> JoinChain
pub fn with_ordinality(self) -> JoinChain
WITH ORDINALITY on the joined function.
Sourcepub fn tablesample(
self,
method: impl Into<Cow<'static, str>>,
args: impl IntoExprList,
) -> JoinChain
pub fn tablesample( self, method: impl Into<Cow<'static, str>>, args: impl IntoExprList, ) -> JoinChain
TABLESAMPLE method (args) on the joined table.
Sourcepub fn repeatable(self, seed: impl IntoExpr) -> JoinChain
pub fn repeatable(self, seed: impl IntoExpr) -> JoinChain
REPEATABLE (seed) on the joined table’s sampling clause.
Sourcepub fn natural(self) -> JoinChain
pub fn natural(self) -> JoinChain
NATURAL <kind> JOIN — derive the join columns from the two items’ names.
Sourcepub fn on(self, condition: impl IntoExpr) -> JoinChain
pub fn on(self, condition: impl IntoExpr) -> JoinChain
ON condition. Several conditions are AND-joined.
Sourcepub fn on_eq(self, a: impl IntoExpr, b: impl IntoExpr) -> JoinChain
pub fn on_eq(self, a: impl IntoExpr, b: impl IntoExpr) -> JoinChain
ON (a = b), the overwhelmingly common shape.
Sourcepub fn using(
self,
columns: impl IntoIterator<Item = impl Into<Cow<'static, str>>>,
) -> JoinChain
pub fn using( self, columns: impl IntoIterator<Item = impl Into<Cow<'static, str>>>, ) -> JoinChain
USING ("a", "b") — join on equally named columns, merging them.
Sourcepub fn using_alias(self, alias: impl Into<Cow<'static, str>>) -> JoinChain
pub fn using_alias(self, alias: impl Into<Cow<'static, str>>) -> JoinChain
USING (…) AS "alias" — name the row of merged join columns
(PostgreSQL 16+), so "alias"."id" refers to the merged column.
Belongs to the USING clause: without using columns
this records a build() error, because there is no merged row for the
alias to name.