use futures_core::future::BoxFuture;
use crate::{Sqlite, SqliteConnection};
use sqlx_core::error::Error;
use sqlx_core::transaction::TransactionManager;
pub struct SqliteTransactionManager;
impl TransactionManager for SqliteTransactionManager {
type Database = Sqlite;
fn begin(conn: &mut SqliteConnection) -> BoxFuture<'_, Result<(), Error>> {
Box::pin(conn.worker.begin())
}
fn commit(conn: &mut SqliteConnection) -> BoxFuture<'_, Result<(), Error>> {
Box::pin(conn.worker.commit())
}
fn rollback(conn: &mut SqliteConnection) -> BoxFuture<'_, Result<(), Error>> {
Box::pin(conn.worker.rollback())
}
fn start_rollback(conn: &mut SqliteConnection) {
conn.worker.start_rollback().ok();
}
}