Select

Struct Select 

Source
pub struct Select {
    pub distinct: bool,
    pub items: Vec<Item>,
    pub from: Vec<From>,
    pub filter: Vec<Expr>,
    pub group: Vec<Name>,
    pub order: Vec<Order>,
    pub limit: Option<usize>,
    pub offset: usize,
}
Expand description

What a query asks for.

The relational half is several tables joined by an equality, a group by with its aggregates, and distinct. None of those is interpreted here — crate::query compiles them into a crate::plan::Plan and crate::engine runs it, so the join in a select and the join in a for loop are one operator (docs/99 §99.9 item 9).

The scalar half is Expr, and it is a per-row expression language rather than the 04 §4.2 Query sub-language: it computes nothing a program could not, and it exists because psql writes case, a function call and a regular expression into the queries it sends the catalogue (crate::pg).

Fields§

§distinct: bool

select distinct — the algebra’s δ, and crate::plan::Op::Distinct is what answers it.

§items: Vec<Item>§from: Vec<From>

The tables, in the order they were written. Empty for select 1; one for a scan; more when the query joins, and every entry after the first carries the equality that joins it.

§filter: Vec<Expr>

The where, as the conjunction it is: every term must be true of a row.

A conjunction rather than one expression because that is the unit a term can be pushed into a scan as — crate::query splits these by the table each names — and and is the operator that makes splitting them sound.

§group: Vec<Name>

group by — the columns whose distinct values are the output’s rows.

§order: Vec<Order>

order by, in the order the keys were written; the first that distinguishes two rows decides.

§limit: Option<usize>§offset: usize

Trait Implementations§

Source§

impl Clone for Select

Source§

fn clone(&self) -> Select

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Select

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Select

§

impl RefUnwindSafe for Select

§

impl Send for Select

§

impl Sync for Select

§

impl Unpin for Select

§

impl UnwindSafe for Select

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.