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
impl Scope
Sourcepub fn add_alias(
&mut self,
alias: &str,
table_name: &str,
columns: Option<HashSet<String>>,
)
pub fn add_alias( &mut self, alias: &str, table_name: &str, columns: Option<HashSet<String>>, )
Register a table alias with its columns.
Sourcepub fn add_qualified_only_alias(
&mut self,
alias: &str,
table_name: &str,
columns: Option<HashSet<String>>,
)
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.
Sourcepub fn has_cte(&self, name: &str) -> bool
pub fn has_cte(&self, name: &str) -> bool
Check if a CTE is visible in this scope (or parent scopes).
Sourcepub fn has_alias(&self, alias: &str) -> bool
pub fn has_alias(&self, alias: &str) -> bool
Check if an alias is visible in this scope (or parent scopes).
Sourcepub fn has_alias_local(&self, alias: &str) -> bool
pub fn has_alias_local(&self, alias: &str) -> bool
Check if an alias is defined locally in this scope.
Sourcepub fn resolve_column(
&self,
schema: &Schema,
table_qualifier: Option<&str>,
column_name: &str,
) -> ResolveResult
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.
Sourcepub fn alias_count(&self) -> usize
pub fn alias_count(&self) -> usize
Number of aliases registered in this scope (not counting parents).
Sourcepub fn known_local_column_sets(&self) -> Vec<&HashSet<String>>
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.