pub trait Schema {
// Required methods
fn dialect(&self) -> Option<DialectType>;
fn add_table(
&mut self,
table: &str,
columns: &[(String, DataType)],
dialect: Option<DialectType>,
) -> SchemaResult<()>;
fn column_names(&self, table: &str) -> SchemaResult<Vec<String>>;
fn get_column_type(
&self,
table: &str,
column: &str,
) -> SchemaResult<DataType>;
fn has_column(&self, table: &str, column: &str) -> bool;
fn supported_table_args(&self) -> &[&str];
fn is_empty(&self) -> bool;
fn depth(&self) -> usize;
fn find_tables_for_column(&self, column: &str) -> Vec<String>;
}Expand description
Abstract trait for database schemas
Required Methods§
Sourcefn dialect(&self) -> Option<DialectType>
fn dialect(&self) -> Option<DialectType>
Get the dialect associated with this schema (if any)
Sourcefn add_table(
&mut self,
table: &str,
columns: &[(String, DataType)],
dialect: Option<DialectType>,
) -> SchemaResult<()>
fn add_table( &mut self, table: &str, columns: &[(String, DataType)], dialect: Option<DialectType>, ) -> SchemaResult<()>
Add or update a table in the schema
Sourcefn column_names(&self, table: &str) -> SchemaResult<Vec<String>>
fn column_names(&self, table: &str) -> SchemaResult<Vec<String>>
Get column names for a table
Sourcefn get_column_type(&self, table: &str, column: &str) -> SchemaResult<DataType>
fn get_column_type(&self, table: &str, column: &str) -> SchemaResult<DataType>
Get the type of a column in a table
Sourcefn has_column(&self, table: &str, column: &str) -> bool
fn has_column(&self, table: &str, column: &str) -> bool
Check if a column exists in a table
Sourcefn supported_table_args(&self) -> &[&str]
fn supported_table_args(&self) -> &[&str]
Get supported table argument levels
Sourcefn find_tables_for_column(&self, column: &str) -> Vec<String>
fn find_tables_for_column(&self, column: &str) -> Vec<String>
Find which table(s) contain the given column name. Returns table names that have the column. Used for correlated subquery resolution.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".