pub struct Resolver<'a> {
pub scope: &'a Scope,
pub dialect: Option<DialectType>,
/* private fields */
}Expand description
Helper for resolving columns to their source tables.
This is a struct so we can lazily load some things and easily share them across functions.
Fields§
§scope: &'a ScopeThe scope being analyzed
dialect: Option<DialectType>The dialect being used
Implementations§
Source§impl<'a> Resolver<'a>
impl<'a> Resolver<'a>
Sourcepub fn new(scope: &'a Scope, schema: &'a dyn Schema, infer_schema: bool) -> Self
pub fn new(scope: &'a Scope, schema: &'a dyn Schema, infer_schema: bool) -> Self
Create a new resolver for a scope
Sourcepub fn get_table(&mut self, column_name: &str) -> Option<String>
pub fn get_table(&mut self, column_name: &str) -> Option<String>
Get the table for a column name.
Returns the table name if it can be found/inferred.
Sourcepub fn get_table_identifier(&mut self, column_name: &str) -> Option<Identifier>
pub fn get_table_identifier(&mut self, column_name: &str) -> Option<Identifier>
Get the table for a column, returning an Identifier
Sourcepub fn all_columns(&mut self) -> &HashSet<String>
pub fn all_columns(&mut self) -> &HashSet<String>
Get all available columns across all sources in this scope
Sourcepub fn get_source_columns(
&mut self,
source_name: &str,
) -> ResolverResult<Vec<String>>
pub fn get_source_columns( &mut self, source_name: &str, ) -> ResolverResult<Vec<String>>
Get column names for a source.
Returns the list of column names available from the given source.
Sourcepub fn get_source_columns_from_set_op(
&self,
expression: &Expression,
) -> ResolverResult<Vec<String>>
pub fn get_source_columns_from_set_op( &self, expression: &Expression, ) -> ResolverResult<Vec<String>>
Get columns from a set operation (UNION, INTERSECT, EXCEPT)
Sourcepub fn is_ambiguous(&mut self, column_name: &str) -> bool
pub fn is_ambiguous(&mut self, column_name: &str) -> bool
Check if a column is ambiguous (appears in multiple sources)
Sourcepub fn sources_for_column(&mut self, column_name: &str) -> Vec<String>
pub fn sources_for_column(&mut self, column_name: &str) -> Vec<String>
Get all sources that contain a given column
Auto Trait Implementations§
impl<'a> Freeze for Resolver<'a>
impl<'a> !RefUnwindSafe for Resolver<'a>
impl<'a> !Send for Resolver<'a>
impl<'a> !Sync for Resolver<'a>
impl<'a> Unpin for Resolver<'a>
impl<'a> !UnwindSafe for Resolver<'a>
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