Skip to main content

Derived

Struct Derived 

Source
pub struct Derived<'a, V: SQLParam, Name, Projection, Query> { /* private fields */ }
Expand description

A complete SELECT used as a named source in another query: (SELECT ...) AS "name".

Create one with a SELECT builder’s .alias(name), where name is a Tag value. Read its columns through fields. Columns of a derived table resolve against its alias, so the scope check treats it like an aliased table.

Implementations§

Source§

impl<'a, V, Name, Projection, Query> Derived<'a, V, Name, Projection, Query>
where V: SQLParam, Name: Tag, Projection: DerivedProjection<Name>,

Source

pub const fn query(&self) -> &Query

Returns the underlying query.

Source

pub fn into_query(self) -> Query

Returns the underlying query by value.

Source

pub fn fields(&self) -> Projection::Fields
where Name: Tag, Projection: DerivedProjection<Name>,

Returns the typed columns of this source, each rendered as "name"."column".

Trait Implementations§

Source§

impl<'a, V: SQLParam, Name, Projection, Query: Clone> Clone for Derived<'a, V, Name, Projection, Query>

Source§

fn clone(&self) -> Self

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<'a, V, Name, Output, Projection, Query> ColumnOf<Derived<'a, V, Name, Projection, Query>> for DerivedField<Name, Output>
where V: SQLParam,

Source§

impl<'a, V, Name, Projection, Query> HasSelectModel for Derived<'a, V, Name, Projection, Query>
where V: SQLParam, Name: Tag, Projection: DerivedProjection<Name>,

Source§

const COLUMN_COUNT: usize = Projection::COLUMN_COUNT

Number of columns in the table.
Source§

type SelectModel = <Projection as DerivedProjection<Name>>::Row

The struct a SELECT * row decodes into.
Source§

impl<V: SQLParam, Name, Projection, Query: ExprSources> ScopeEntry for Derived<'_, V, Name, Projection, Query>

Source§

type Key = AliasKey<Name>

How columns refer to this source: a TableKey or an AliasKey.
Source§

type Nullable = NonNull

Null when an outer join can leave this source NULL.
Source§

type Sources = <Query as ExprSources>::Sources

Sources this source reads itself, such as the tables a derived table’s subquery reads from an outer query. They resolve against the enclosing query (or, for a LATERAL join, the sources joined before it). Tables and views read nothing (()).
Source§

impl<'a, V, Name, Projection, Query> ToSQL<'a, V> for Derived<'a, V, Name, Projection, Query>
where V: SQLParam, Name: Tag, Query: ToSQL<'a, V>,

Source§

fn to_sql(&self) -> SQL<'a, V>

Renders self as a SQL fragment.
Source§

fn into_sql(self) -> SQL<'a, V>

Renders self as a SQL fragment, consuming it. Read more

Auto Trait Implementations§

§

impl<'a, V, Name, Projection, Query> Freeze for Derived<'a, V, Name, Projection, Query>
where Query: Freeze, PhantomData<(&'a (), V, Name, Projection)>: Freeze,

§

impl<'a, V, Name, Projection, Query> RefUnwindSafe for Derived<'a, V, Name, Projection, Query>
where Query: RefUnwindSafe, PhantomData<(&'a (), V, Name, Projection)>: RefUnwindSafe,

§

impl<'a, V, Name, Projection, Query> Send for Derived<'a, V, Name, Projection, Query>
where Query: Send, PhantomData<(&'a (), V, Name, Projection)>: Send,

§

impl<'a, V, Name, Projection, Query> Sync for Derived<'a, V, Name, Projection, Query>
where Query: Sync, PhantomData<(&'a (), V, Name, Projection)>: Sync,

§

impl<'a, V, Name, Projection, Query> Unpin for Derived<'a, V, Name, Projection, Query>
where Query: Unpin, PhantomData<(&'a (), V, Name, Projection)>: Unpin,

§

impl<'a, V, Name, Projection, Query> UnsafeUnpin for Derived<'a, V, Name, Projection, Query>
where Query: UnsafeUnpin, PhantomData<(&'a (), V, Name, Projection)>: UnsafeUnpin,

§

impl<'a, V, Name, Projection, Query> UnwindSafe for Derived<'a, V, Name, Projection, Query>
where Query: UnwindSafe, PhantomData<(&'a (), V, Name, Projection)>: UnwindSafe,

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<List> ListIncludes<Nil, ()> for List

Source§

impl<Mk> MarkerAggValidFor<()> for Mk

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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> TypeEq<T> for T