pub struct TableChain<S> { /* private fields */ }Expand description
A from-item under construction: the table plus every decoration PostgreSQL’s
from_item allows in front of the joins.
[ ONLY ] table_name [ * ] [ [ AS ] alias [ ( column_alias [, ...] ) ] ]
[ TABLESAMPLE sampling_method ( argument [, ...] ) [ REPEATABLE ( seed ) ] ]
[ LATERAL ] function_name ( … ) [ WITH ORDINALITY ] [ [ AS ] alias [ ( … ) ] ]Implementations§
Source§impl<S> TableChain<S>
impl<S> TableChain<S>
Sourcepub fn columns(
self,
columns: impl IntoIterator<Item = impl Into<Cow<'static, str>>>,
) -> TableChain<S>
pub fn columns( self, columns: impl IntoIterator<Item = impl Into<Cow<'static, str>>>, ) -> TableChain<S>
Column aliases: AS "t" ("a", "b"). For an INSERT this is the insert
column list instead.
Sourcepub fn only(self) -> TableChain<S>
pub fn only(self) -> TableChain<S>
ONLY — do not include rows from inheriting tables.
Sourcepub fn lateral(self) -> TableChain<S>
pub fn lateral(self) -> TableChain<S>
LATERAL — let this item refer to columns of the ones before it.
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
FROM LATERAL "posts" is a syntax error with nothing to mean.
Sourcepub fn with_ordinality(self) -> TableChain<S>
pub fn with_ordinality(self) -> TableChain<S>
WITH ORDINALITY — add a bigint column numbering the rows.
Sourcepub fn tablesample(
self,
method: impl Into<Cow<'static, str>>,
args: impl IntoExprList,
) -> TableChain<S>
pub fn tablesample( self, method: impl Into<Cow<'static, str>>, args: impl IntoExprList, ) -> TableChain<S>
TABLESAMPLE method (args), e.g. tablesample("BERNOULLI", 10).
Sourcepub fn repeatable(self, seed: impl IntoExpr) -> TableChain<S>
pub fn repeatable(self, seed: impl IntoExpr) -> TableChain<S>
REPEATABLE (seed) — the same sample every time.
Ignored without a tablesample, because
REPEATABLE is a modifier of one and means nothing alone.
Source§impl TableChain<ExtraSlot>
impl TableChain<ExtraSlot>
Sourcepub fn join(self, join: impl Into<Join>) -> TableChain<ExtraSlot>
pub fn join(self, join: impl Into<Join>) -> TableChain<ExtraSlot>
A join hanging off this comma-separated item rather than off the
leading one: FROM "a", "b" INNER JOIN "c" ON ….
Grammatical because gram.y’s from_list is table_ref (',' table_ref)*
and every table_ref — not just the first — may be a joined_table.
The join binds tighter than the comma, so "b" INNER JOIN "c" is one
from-item. Takes the same JoinChain/CrossJoinChain the standalone
join mods are — those mods reach the leading item through HasJoins,
which is why the extra items take theirs by method instead. Several
calls chain several joins onto this item, exactly as several standalone
mods do onto the leading one.
Trait Implementations§
Source§impl<S: Clone> Clone for TableChain<S>
impl<S: Clone> Clone for TableChain<S>
Source§fn clone(&self) -> TableChain<S>
fn clone(&self) -> TableChain<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more