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§
fn dialect(&self) -> &dyn Dialect
fn query<'a>( &'a self, sql: &'a str, params: &'a [SqlValue], rows: &'a mut dyn RowSink, ) -> BoxFuture<'a, Result<()>>
Sourcefn transaction(&self, steps: Vec<Step>) -> BoxFuture<'_, Result<()>>
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§
Sourcefn 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 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.
Sourcefn lock_migrations(
&self,
) -> Option<BoxFuture<'_, Result<Box<dyn MigrationsLock>>>>
fn lock_migrations( &self, ) -> Option<BoxFuture<'_, Result<Box<dyn MigrationsLock>>>>
Held over a whole Schema::migrate until dropped; else each migration’s transaction locks.
Sourcefn migrate_alone<'a>(
&'a self,
schema: &'a str,
sql: &'a str,
record: Step,
) -> Result<BoxFuture<'a, Result<()>>, Step>
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.
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>>>>
Sourcefn cache_notifications(
&self,
) -> Option<BoxFuture<'_, Result<Box<dyn Notifications>>>>
fn cache_notifications( &self, ) -> Option<BoxFuture<'_, Result<Box<dyn Notifications>>>>
The payloads sent to the sofie_cache channel, such as by pg_notify.
Sourcefn change_notifications(
&self,
) -> Option<BoxFuture<'_, Result<Box<dyn Notifications>>>>
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".