mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-13 17:27:50 +00:00
implement RefExecutor ( allow Query/QueryAs ) for Transaction
This commit is contained in:
parent
10d2b45d9c
commit
6ffcf41b0f
@ -6,7 +6,7 @@ use crate::connection::Connection;
|
||||
use crate::database::Database;
|
||||
use crate::database::HasCursor;
|
||||
use crate::describe::Describe;
|
||||
use crate::executor::{Execute, Executor};
|
||||
use crate::executor::{Execute, Executor, RefExecutor};
|
||||
use crate::runtime::spawn;
|
||||
|
||||
// Transaction<PoolConnection<PgConnection>>
|
||||
@ -127,6 +127,21 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'c, DB, T> RefExecutor<'c> for &'c mut Transaction<T>
|
||||
where
|
||||
DB: Database,
|
||||
T: Connection<Database = DB>,
|
||||
{
|
||||
type Database = DB;
|
||||
|
||||
fn fetch_by_ref<'q, E>(self, query: E) -> <Self::Database as HasCursor<'c, 'q>>::Cursor
|
||||
where
|
||||
E: Execute<'q, Self::Database>,
|
||||
{
|
||||
(**self).fetch(query)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Drop for Transaction<T>
|
||||
where
|
||||
T: Connection,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user