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 query_read_only<'a>(
        &'a self,
        role: Option<&'a str>,
        sql: &'a str,
        params: &'a [SqlValue],
        rows: &'a mut dyn RowSink,
    ) -> BoxFuture<'a, Result<()>> { ... }
    fn lock_migrations(
        &self,
    ) -> Option<BoxFuture<'_, Result<Box<dyn MigrationsLock>>>> { ... }
    fn migrate_alone<'a>(
        &'a self,
        schema: &'a str,
        sql: &'a str,
        record: Step,
    ) -> Result<BoxFuture<'a, Result<()>>, Step> { ... }
    fn catalog(&self) -> Option<&dyn Catalog> { ... }
    fn wakeups(&self) -> Option<BoxFuture<'_, Result<Box<dyn Wakeups>>>> { ... }
    fn flag_wakeups(&self) -> Option<BoxFuture<'_, Result<Box<dyn Wakeups>>>> { ... }
    fn shield_wakeups(&self) -> Option<BoxFuture<'_, Result<Box<dyn Wakeups>>>> { ... }
    fn cache_notifications(
        &self,
    ) -> Option<BoxFuture<'_, Result<Box<dyn Notifications>>>> { ... }
    fn change_notifications(
        &self,
    ) -> Option<BoxFuture<'_, Result<Box<dyn Notifications>>>> { ... }
}

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 query_read_only<'a>( &'a self, role: Option<&'a str>, sql: &'a str, params: &'a [SqlValue], rows: &'a mut dyn RowSink, ) -> BoxFuture<'a, Result<()>>

Read-only, as nothing else keeps raw SQL from writing.

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 migrate_alone<'a>( &'a self, schema: &'a str, sql: &'a str, record: Step, ) -> Result<BoxFuture<'a, Result<()>>, Step>

Outside a transaction, under lock_migrations; other migrations get record back.

Source

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

Source

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

Source

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

Source

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

Source

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

The payloads sent to the sofie_cache channel, such as by pg_notify.

Source

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

The payloads Dialect::live_notify sent.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§