Skip to main content

TableChain

Struct TableChain 

Source
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>

Source

pub fn as_(self, alias: impl Into<Cow<'static, str>>) -> TableChain<S>

AS "alias".

Source

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.

Source

pub fn only(self) -> TableChain<S>

ONLY — do not include rows from inheriting tables.

Source

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.

Source

pub fn with_ordinality(self) -> TableChain<S>

WITH ORDINALITY — add a bigint column numbering the rows.

Source

pub fn tablesample( self, method: impl Into<Cow<'static, str>>, args: impl IntoExprList, ) -> TableChain<S>

TABLESAMPLE method (args), e.g. tablesample("BERNOULLI", 10).

Source

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>

Source

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>

Source§

fn clone(&self) -> TableChain<S>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug> Debug for TableChain<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Q, S: TableSlot<Q>> Mod<Q> for TableChain<S>

Source§

fn apply(self, q: &mut Q)

Apply this modification to q.

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for TableChain<S>

§

impl<S> !UnwindSafe for TableChain<S>

§

impl<S> Freeze for TableChain<S>

§

impl<S> Send for TableChain<S>
where S: Send,

§

impl<S> Sync for TableChain<S>
where S: Sync,

§

impl<S> Unpin for TableChain<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for TableChain<S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.