Skip to main content

TableChain

Struct TableChain 

Source
pub struct TableChain<S> { /* private fields */ }
Expand description

A table reference under construction: the table plus every decoration MySQL’s table_factor allows.

tbl_name [PARTITION (partition_names)] [[AS] alias] [index_hint_list]
[LATERAL] table_subquery [AS] alias [(col_list)]

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`), which MySQL 8.0.19 allows on a derived table. For an INSERTorREPLACE` this is the column list instead.

Source

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

LATERAL — let a derived table refer to columns of the items before it (MySQL 8.0.14).

Only grammatical in front of a derived table; 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 partition( self, partitions: impl IntoIterator<Item = impl Into<Cow<'static, str>>>, ) -> TableChain<S>

PARTITION (\p0`, `p1`)` — read only these partitions.

Source

pub fn use_index( self, indexes: impl IntoIterator<Item = impl Into<Cow<'static, str>>>, ) -> TableChain<S>

USE INDEX (…) — consider only these indexes. An empty list is meaningful: USE INDEX () tells MySQL to use none.

Source

pub fn ignore_index( self, indexes: impl IntoIterator<Item = impl Into<Cow<'static, str>>>, ) -> TableChain<S>

IGNORE INDEX (…) — do not consider these indexes.

Source

pub fn force_index( self, indexes: impl IntoIterator<Item = impl Into<Cow<'static, str>>>, ) -> TableChain<S>

FORCE INDEX (…) — a table scan is not acceptable.

Source

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

FOR JOIN on the hint just added.

Ignored if no hint has been added: a scope with nothing to scope means nothing, and FOR JOIN is not a clause of its own.

Source

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

FOR ORDER BY on the hint just added.

Source

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

FOR GROUP BY on the hint just added.

Source§

impl TableChain<ExtraSlot>

Source

pub fn join(self, join: impl Into<Join>) -> TableChain<ExtraSlot>

A join hanging off this comma-separated table reference rather than off the leading one: FROM `a`, `b` INNER JOIN `c` ON ….

Grammatical because 15.2.15.2 JOIN Clause reads table_references: escaped_table_reference [, escaped_table_reference] … and each table_reference — not just the first — may be a joined_table. The comma has lower precedence than the join keywords (the manual says so under the same section), so b INNER JOIN c is one list entry and the join’s left operand is this item alone. Takes the same JoinChain/PlainJoinChain the standalone join mods are — those 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.

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.