forked from transact-rs/sqlx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecutor.rs
More file actions
36 lines (32 loc) · 962 Bytes
/
Copy pathexecutor.rs
File metadata and controls
36 lines (32 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use crate::connection::Connection;
use crate::database::Database;
use crate::error::Error;
use crate::execute::Execute;
use futures_core::future::BoxFuture;
pub trait Executor<'e> {
type Database: Database;
/// Execute the SQL query.
///
/// Returns a value of [`Done`] which signals successful query completion and provides
/// the number of rows affected; plus, any additional database-specific information (such as
/// the last inserted ID).
fn execute<'x, 'q: 'x, E: 'x + Execute<'q, Self::Database>>(
self,
query: E,
) -> BoxFuture<'x, Result<u64, Error>>
where
'e: 'x;
}
impl<'c, C: Connection> Executor<'c> for &'c mut C {
type Database = C::Database;
#[inline]
fn execute<'x, 'q: 'x, E: 'x + Execute<'q, Self::Database>>(
self,
query: E,
) -> BoxFuture<'x, Result<u64, Error>>
where
'c: 'x,
{
Connection::execute(self, query)
}
}