pub struct ResolverScope {
pub tables: Vec<TableSchema>,
pub parent: Option<Box<Self>>,
}Expand description
A scope for name resolution, supporting nested subquery scopes.
Fields§
§tables: Vec<TableSchema>Tables available in this scope.
parent: Option<Box<Self>>Parent scope (for correlated subquery resolution).
Implementations§
Source§impl ResolverScope
impl ResolverScope
Sourcepub fn new(tables: Vec<TableSchema>) -> Self
pub fn new(tables: Vec<TableSchema>) -> Self
Create a new root scope with the given table schemas.
Sourcepub fn child(self, tables: Vec<TableSchema>) -> Self
pub fn child(self, tables: Vec<TableSchema>) -> Self
Create a child scope for a subquery, with this scope as the parent.
Sourcepub fn resolve(
&self,
col: &ColumnRef,
span: Span,
) -> Result<ResolvedColumn, ResolveError>
pub fn resolve( &self, col: &ColumnRef, span: Span, ) -> Result<ResolvedColumn, ResolveError>
Resolve a possibly-qualified column reference.
For qualified refs (t.col): find table t in scope, then verify col.
For unqualified refs (col): search all tables; error if ambiguous.
If not found in this scope, search parent scopes (correlated subquery).
Sourcepub fn expand_star(&self) -> Vec<(String, String)>
pub fn expand_star(&self) -> Vec<(String, String)>
Expand SELECT * to explicit column references.
Returns a list of (table_name, column_name) pairs in order.
Sourcepub fn expand_table_star(
&self,
table_name: &str,
span: Span,
) -> Result<Vec<(String, String)>, ResolveError>
pub fn expand_table_star( &self, table_name: &str, span: Span, ) -> Result<Vec<(String, String)>, ResolveError>
Expand table.* to explicit column references.
Trait Implementations§
Source§impl Clone for ResolverScope
impl Clone for ResolverScope
Source§fn clone(&self) -> ResolverScope
fn clone(&self) -> ResolverScope
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ResolverScope
impl RefUnwindSafe for ResolverScope
impl Send for ResolverScope
impl Sync for ResolverScope
impl Unpin for ResolverScope
impl UnsafeUnpin for ResolverScope
impl UnwindSafe for ResolverScope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more