pub trait SqlDialect: Send + Sync {
// Required methods
fn placeholder(&self, index: usize) -> String;
fn quote_ident(&self, name: &str) -> String;
fn sql_type(&self, col_type: &ColumnType) -> String;
fn supports_returning(&self) -> bool;
fn upsert_syntax(&self) -> UpsertSyntax;
}Expand description
SQL dialect controls syntax differences between backends.
Required Methods§
Sourcefn placeholder(&self, index: usize) -> String
fn placeholder(&self, index: usize) -> String
Placeholder style: $1 for Postgres, ? for MySQL.
Sourcefn quote_ident(&self, name: &str) -> String
fn quote_ident(&self, name: &str) -> String
Quote an identifier (table name, column name).
Sourcefn sql_type(&self, col_type: &ColumnType) -> String
fn sql_type(&self, col_type: &ColumnType) -> String
Map a ColumnType to dialect-specific SQL type string.
Sourcefn supports_returning(&self) -> bool
fn supports_returning(&self) -> bool
Whether RETURNING clause is supported (Postgres yes, MySQL no).
Sourcefn upsert_syntax(&self) -> UpsertSyntax
fn upsert_syntax(&self) -> UpsertSyntax
Whether INSERT OR IGNORE / ON CONFLICT DO NOTHING is supported.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".