Skip to main content

Schema

Trait Schema 

Source
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§

Source

fn dialect(&self) -> Option<DialectType>

Get the dialect associated with this schema (if any)

Source

fn add_table( &mut self, table: &str, columns: &[(String, DataType)], dialect: Option<DialectType>, ) -> SchemaResult<()>

Add or update a table in the schema

Source

fn column_names(&self, table: &str) -> SchemaResult<Vec<String>>

Get column names for a table

Source

fn get_column_type(&self, table: &str, column: &str) -> SchemaResult<DataType>

Get the type of a column in a table

Source

fn has_column(&self, table: &str, column: &str) -> bool

Check if a column exists in a table

Source

fn supported_table_args(&self) -> &[&str]

Get supported table argument levels

Source

fn is_empty(&self) -> bool

Check if the schema is empty

Source

fn depth(&self) -> usize

Get the nesting depth of the schema

Implementors§