pub trait DatabaseExecutor:
Debug
+ Sync
+ Send {
// Required methods
fn name() -> &'static str;
fn execute<'life0, 'async_trait>(
&'life0 self,
statement: Statement,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn fetch_one<'life0, 'async_trait>(
&'life0 self,
statement: Statement,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Column>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn fetch_all<'life0, 'async_trait>(
&'life0 self,
statement: Statement,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<Column>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn pluck<'life0, 'async_trait>(
&'life0 self,
statement: Statement,
) -> Pin<Box<dyn Future<Output = Result<Option<Column>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn batch<'life0, 'async_trait>(
&'life0 self,
statement: Statement,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Database Executor
This trait defines the expectations of a database execution
Required Methods§
Sourcefn execute<'life0, 'async_trait>(
&'life0 self,
statement: Statement,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
statement: Statement,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes a query and returns the affected rows
Sourcefn fetch_one<'life0, 'async_trait>(
&'life0 self,
statement: Statement,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Column>>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fetch_one<'life0, 'async_trait>(
&'life0 self,
statement: Statement,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Column>>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Runs the query and returns the first row or None
Sourcefn fetch_all<'life0, 'async_trait>(
&'life0 self,
statement: Statement,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<Column>>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fetch_all<'life0, 'async_trait>(
&'life0 self,
statement: Statement,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<Column>>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Runs the query and returns the first row or None
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".