pub trait Executor{
type Queries: QueryRepository;
// Required methods
fn apply_tx(
&mut self,
query: &Query,
) -> impl Future<Output = TernResult<()>> + Send;
fn apply_no_tx(
&mut self,
query: &Query,
) -> impl Future<Output = TernResult<()>> + Send;
fn create_history_if_not_exists(
&mut self,
history_table: &str,
) -> impl Future<Output = TernResult<()>> + Send;
fn drop_history(
&mut self,
history_table: &str,
) -> impl Future<Output = TernResult<()>> + Send;
fn get_all_applied(
&mut self,
history_table: &str,
) -> impl Future<Output = TernResult<Vec<AppliedMigration>>> + Send;
fn insert_applied_migration(
&mut self,
history_table: &str,
applied: &AppliedMigration,
) -> impl Future<Output = TernResult<()>> + Send;
fn upsert_applied_migration(
&mut self,
history_table: &str,
applied: &AppliedMigration,
) -> impl Future<Output = TernResult<()>> + Send;
}Expand description
The “executor” type for the database backend ultimately responsible for issuing migration and schema history queries.
Required Associated Types§
Sourcetype Queries: QueryRepository
type Queries: QueryRepository
The type of value that can produce queries for the history table of this migration set.
Required Methods§
Sourcefn apply_tx(
&mut self,
query: &Query,
) -> impl Future<Output = TernResult<()>> + Send
fn apply_tx( &mut self, query: &Query, ) -> impl Future<Output = TernResult<()>> + Send
Apply the Query for the migration in a transaction.
Sourcefn apply_no_tx(
&mut self,
query: &Query,
) -> impl Future<Output = TernResult<()>> + Send
fn apply_no_tx( &mut self, query: &Query, ) -> impl Future<Output = TernResult<()>> + Send
Apply the Query for the migration not in a transaction.
Sourcefn create_history_if_not_exists(
&mut self,
history_table: &str,
) -> impl Future<Output = TernResult<()>> + Send
fn create_history_if_not_exists( &mut self, history_table: &str, ) -> impl Future<Output = TernResult<()>> + Send
CREATE IF NOT EXISTS the history table.
Sourcefn drop_history(
&mut self,
history_table: &str,
) -> impl Future<Output = TernResult<()>> + Send
fn drop_history( &mut self, history_table: &str, ) -> impl Future<Output = TernResult<()>> + Send
DROP the history table.
Sourcefn get_all_applied(
&mut self,
history_table: &str,
) -> impl Future<Output = TernResult<Vec<AppliedMigration>>> + Send
fn get_all_applied( &mut self, history_table: &str, ) -> impl Future<Output = TernResult<Vec<AppliedMigration>>> + Send
Get the complete history of applied migrations.
Sourcefn insert_applied_migration(
&mut self,
history_table: &str,
applied: &AppliedMigration,
) -> impl Future<Output = TernResult<()>> + Send
fn insert_applied_migration( &mut self, history_table: &str, applied: &AppliedMigration, ) -> impl Future<Output = TernResult<()>> + Send
Insert an applied migration into the history table.
Sourcefn upsert_applied_migration(
&mut self,
history_table: &str,
applied: &AppliedMigration,
) -> impl Future<Output = TernResult<()>> + Send
fn upsert_applied_migration( &mut self, history_table: &str, applied: &AppliedMigration, ) -> impl Future<Output = TernResult<()>> + Send
Update or insert an applied migration.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl<Db, Q> Executor for SqlxExecutor<Db, Q>where
Self: Send + Sync + 'static,
Q: QueryRepository,
Db: Database,
for<'c> &'c mut <Db as Database>::Connection: Executor<'c, Database = Db>,
for<'q> <Db as Database>::Arguments<'q>: IntoArguments<'q, Db>,
for<'r> AppliedMigration: FromRow<'r, <Db as Database>::Row>,
String: Type<Db> + for<'a> Encode<'a, Db>,
i64: Type<Db> + for<'a> Encode<'a, Db>,
DateTime<Utc>: Type<Db> + for<'a> Encode<'a, Db>,
Available on crate features sqlx_mysql or sqlx_postgres or sqlx_sqlite only.SqlxExecutor can be an Executor fairly straightforwardly when enough
bounds involving Db: sqlx::Database are added to make it compile.
impl<Db, Q> Executor for SqlxExecutor<Db, Q>where
Self: Send + Sync + 'static,
Q: QueryRepository,
Db: Database,
for<'c> &'c mut <Db as Database>::Connection: Executor<'c, Database = Db>,
for<'q> <Db as Database>::Arguments<'q>: IntoArguments<'q, Db>,
for<'r> AppliedMigration: FromRow<'r, <Db as Database>::Row>,
String: Type<Db> + for<'a> Encode<'a, Db>,
i64: Type<Db> + for<'a> Encode<'a, Db>,
DateTime<Utc>: Type<Db> + for<'a> Encode<'a, Db>,
Available on crate features
sqlx_mysql or sqlx_postgres or sqlx_sqlite only.SqlxExecutor can be an Executor fairly straightforwardly when enough
bounds involving Db: sqlx::Database are added to make it compile.