Skip to main content

Dialect

Trait Dialect 

Source
pub trait Dialect {
    // Required methods
    fn render_select(&self, select: &Select) -> Result<Sql>;
    fn render_insert(&self, insert: &Insert) -> Result<Sql>;
    fn render_update(&self, update: &Update) -> Result<Sql>;
    fn render_delete(&self, delete: &Delete) -> Result<Sql>;

    // Provided method
    fn supports_returning(&self) -> bool { ... }
}
Expand description

Trait for SQL dialect renderers.

Allows rendering AST queries into dialect-specific SQL strings.

Required Methods§

Source

fn render_select(&self, select: &Select) -> Result<Sql>

Render a SELECT query into SQL.

Source

fn render_insert(&self, insert: &Insert) -> Result<Sql>

Render an INSERT query into SQL.

Source

fn render_update(&self, update: &Update) -> Result<Sql>

Render an UPDATE query into SQL.

Source

fn render_delete(&self, delete: &Delete) -> Result<Sql>

Render a DELETE query into SQL.

Provided Methods§

Source

fn supports_returning(&self) -> bool

Whether this dialect natively supports the RETURNING clause on INSERT, UPDATE, and DELETE statements.

Dialects that return false (e.g. MySQL) will have RETURNING emulated at the connector layer via separate queries.

Implementors§

Source§

impl Dialect for MysqlDialect

Renders query ASTs into MySQL-compatible SQL with ? placeholders and backtick-quoted identifiers.

Source§

impl Dialect for PostgresDialect

Source§

impl Dialect for SqliteDialect

Renders query ASTs into SQLite-compatible SQL with ? placeholders and double-quoted identifiers.