Skip to main content

DatabaseDriver

Trait DatabaseDriver 

Source
pub trait DatabaseDriver:
    Send
    + Sync
    + 'static {
    type Database: Database;
    type Dialect: Dialect;
}
Expand description

Unifies a sqlx Database type with its crate::Dialect.

Each backend (SqliteDriver, PostgresDriver) implements this trait once. Consumer crates use D: DatabaseDriver as their single generic parameter, which gives access to both D::Database (for sqlx pool/query bounds) and D::Dialect (for SQL fragment substitution).

Connection, migration, and transaction logic live in crate::DbConfig, crate::migrate, and crate::transaction respectively — not here.

Required Associated Types§

Source

type Database: Database

The sqlx Database type (e.g., sqlx::Sqlite, sqlx::Postgres).

Source

type Dialect: Dialect

The dialect providing SQL fragment constants.

Implementors§