Skip to main content

SqlxDialect

Trait SqlxDialect 

Source
pub trait SqlxDialect: Dialect + Sealed {
    type Database: Database<Arguments: IntoArguments<Self::Database>>;

    // Required method
    fn bind_arguments(
        binds: &[Value],
    ) -> <Self::Database as Database>::Arguments;
}
Expand description

Sealed sub-trait carrying the sqlx binding for a dialect.

Sealed via the private [private::Sealed] supertrait so only the dialect markers in this crate can implement it.

Required Associated Types§

Source

type Database: Database<Arguments: IntoArguments<Self::Database>>

The sqlx Database this dialect binds against.

The database’s owned Arguments must be IntoArguments<Self::Database> (it always is for sqlx’s built-in databases) so the produced query type is executable.

Required Methods§

Source

fn bind_arguments(binds: &[Value]) -> <Self::Database as Database>::Arguments

Build owned Arguments for binds.

Mirrors 1.x value_to_arguments: each Value is appended with arguments.add(..). The sqlx encoders for this M1 Value set are infallible, so the add result is discarded with let _ =.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl SqlxDialect for MySql

Available on crate feature sqlx_mysql only.
Source§

impl SqlxDialect for Postgres

Available on crate feature sqlx_postgres only.
Source§

impl SqlxDialect for Sqlite

Available on crate feature sqlx_sqlite only.