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;
    fn find_tables_for_column(&self, column: &str) -> Vec<String>;
}
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

Source

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".

Implementors§