Skip to main content

Driver

Trait Driver 

Source
pub trait Driver:
    Send
    + Sync
    + 'static {
    // Required methods
    fn dialect(&self) -> &dyn Dialect;
    fn query<'a>(
        &'a self,
        sql: &'a str,
        params: &'a [SqlValue],
        rows: &'a mut dyn RowSink,
    ) -> BoxFuture<'a, Result<()>>;
    fn transaction(&self, steps: Vec<Step>) -> BoxFuture<'_, Result<()>>;

    // Provided methods
    fn lock_migrations(
        &self,
    ) -> Option<BoxFuture<'_, Result<Box<dyn MigrationsLock>>>> { ... }
    fn catalog(&self) -> Option<&dyn Catalog> { ... }
    fn wakeups(&self) -> Option<BoxFuture<'_, Result<Box<dyn Wakeups>>>> { ... }
}

Required Methods§

Source

fn dialect(&self) -> &dyn Dialect

Source

fn query<'a>( &'a self, sql: &'a str, params: &'a [SqlValue], rows: &'a mut dyn RowSink, ) -> BoxFuture<'a, Result<()>>

Source

fn transaction(&self, steps: Vec<Step>) -> BoxFuture<'_, Result<()>>

A unique-index refusal fails as Internal with a UniqueViolation source; a check, exclusion or foreign key as Rule (check_refusal, exclusion_refusal, …).

Provided Methods§

Source

fn lock_migrations( &self, ) -> Option<BoxFuture<'_, Result<Box<dyn MigrationsLock>>>>

Held over a whole Schema::migrate until dropped; else each migration’s transaction locks.

Source

fn catalog(&self) -> Option<&dyn Catalog>

Source

fn wakeups(&self) -> Option<BoxFuture<'_, Result<Box<dyn Wakeups>>>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§