Skip to main content

Scope

Struct Scope 

Source
pub struct Scope {
    pub using_columns: HashSet<String>,
    /* private fields */
}
Expand description

A name scope for query resolution. Scopes nest for subqueries and CTEs.

Fields§

§using_columns: HashSet<String>

Columns that were joined via USING and are therefore unambiguous.

Implementations§

Source§

impl Scope

Source

pub fn root() -> Self

Create a root scope.

Source

pub fn child(parent: Self) -> Self

Create a child scope (for subqueries).

Source

pub fn add_alias( &mut self, alias: &str, table_name: &str, columns: Option<HashSet<String>>, )

Register a table alias with its columns.

Source

pub fn add_qualified_only_alias( &mut self, alias: &str, table_name: &str, columns: Option<HashSet<String>>, )

Register an alias that does not participate in unqualified column resolution.

Source

pub fn add_cte(&mut self, name: &str)

Register a CTE name.

Source

pub fn has_cte(&self, name: &str) -> bool

Check if a CTE is visible in this scope (or parent scopes).

Source

pub fn has_alias(&self, alias: &str) -> bool

Check if an alias is visible in this scope (or parent scopes).

Source

pub fn has_alias_local(&self, alias: &str) -> bool

Check if an alias is defined locally in this scope.

Source

pub fn resolve_column( &self, schema: &Schema, table_qualifier: Option<&str>, column_name: &str, ) -> ResolveResult

Resolve a column reference: find which alias provides it.

If table_qualifier is Some, checks only that alias. If None, searches all visible aliases for the column name. Returns the resolved (alias, column_name) or None.

Source

pub fn alias_count(&self) -> usize

Number of aliases registered in this scope (not counting parents).

Source

pub fn known_local_column_sets(&self) -> Vec<&HashSet<String>>

Return known column sets from all local aliases (for NATURAL JOIN). Aliases with unknown columns (None) are omitted.

Source

pub fn columns_for_alias(&self, alias: &str) -> Option<&HashSet<String>>

Return the column set for a specific alias (lowercased lookup).

Trait Implementations§

Source§

impl Clone for Scope

Source§

fn clone(&self) -> Scope

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 Scope

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Scope

§

impl RefUnwindSafe for Scope

§

impl Send for Scope

§

impl Sync for Scope

§

impl Unpin for Scope

§

impl UnsafeUnpin for Scope

§

impl UnwindSafe for Scope

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more