pub trait SqlGenerator {
Show 15 methods // Required methods fn create_table(name: &str, schema: Option<&str>) -> String; fn create_table_if_not_exists(name: &str, schema: Option<&str>) -> String; fn drop_table(name: &str, schema: Option<&str>) -> String; fn drop_table_if_exists(name: &str, schema: Option<&str>) -> String; fn rename_table(old: &str, new: &str, schema: Option<&str>) -> String; fn alter_table(name: &str, schema: Option<&str>) -> String; fn add_column( ex: bool, schema: Option<&str>, name: &str, _type: &Type ) -> String; fn drop_column(name: &str) -> String; fn rename_column(old: &str, new: &str) -> String; fn create_index( table: &str, schema: Option<&str>, name: &str, _type: &Type ) -> String; fn create_constraint( name: &str, _type: &Type, schema: Option<&str> ) -> String; fn drop_index(name: &str) -> String; fn add_foreign_key( columns: &[String], table: &str, relation_columns: &[String], schema: Option<&str> ) -> String; fn add_primary_key(columns: &[String]) -> String; // Provided method fn create_partial_index( table: &str, schema: Option<&str>, name: &str, _type: &Type, conditions: &str ) -> String { ... }
}
Expand description

A generic SQL generator trait

Required Methods§

source

fn create_table(name: &str, schema: Option<&str>) -> String

Create a new table with a name

source

fn create_table_if_not_exists(name: &str, schema: Option<&str>) -> String

Create a new table with a name, only if it doesn’t exist

source

fn drop_table(name: &str, schema: Option<&str>) -> String

Drop a table with a name

source

fn drop_table_if_exists(name: &str, schema: Option<&str>) -> String

Drop a table with a name, only if it exists

source

fn rename_table(old: &str, new: &str, schema: Option<&str>) -> String

Rename a table from to

source

fn alter_table(name: &str, schema: Option<&str>) -> String

Modify a table in some other way

source

fn add_column( ex: bool, schema: Option<&str>, name: &str, _type: &Type ) -> String

Create a new column with a type

source

fn drop_column(name: &str) -> String

Drop an existing column from the table

source

fn rename_column(old: &str, new: &str) -> String

Rename an existing column

source

fn create_index( table: &str, schema: Option<&str>, name: &str, _type: &Type ) -> String

Create a multi-column index

source

fn create_constraint(name: &str, _type: &Type, schema: Option<&str>) -> String

Create a constraint

source

fn drop_index(name: &str) -> String

Drop a multi-column index

source

fn add_foreign_key( columns: &[String], table: &str, relation_columns: &[String], schema: Option<&str> ) -> String

Add a foreign key

source

fn add_primary_key(columns: &[String]) -> String

Provided Methods§

source

fn create_partial_index( table: &str, schema: Option<&str>, name: &str, _type: &Type, conditions: &str ) -> String

Create a multi-column index

Object Safety§

This trait is not object safe.

Implementors§