Skip to main content

Dialect

Trait Dialect 

Source
pub trait Dialect: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn quote_identifier(&self, ident: &str) -> String;
    fn bind_parameter(&self, index: usize) -> String;
    fn supports_returning(&self) -> bool;
}
Expand description

Describes how a specific database handles SQL syntax differences.

Required Methods§

Source

fn name(&self) -> &'static str

Returns the dialect name (e.g. “sqlite”, “postgres”, “mysql”).

Source

fn quote_identifier(&self, ident: &str) -> String

Quote an identifier (table name, column name).

  • Postgres/SQLite: "identifier"
  • MySQL: `identifier`
Source

fn bind_parameter(&self, index: usize) -> String

Return the bind parameter placeholder for the given 1-based index.

  • Postgres: $1, $2, …
  • SQLite/MySQL: ?
Source

fn supports_returning(&self) -> bool

Whether this dialect supports the RETURNING clause on INSERT/UPDATE/DELETE.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§