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;
}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