pub trait Database:
Send
+ Sync
+ Debug {
// Required methods
fn db_type(&self) -> DatabaseType;
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<AnyRow>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn query_one<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AnyRow>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn ping<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn begin_transaction<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DbTransaction>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn execute_query<'q, 'life0, 'async_trait>(
&'life0 self,
query: Query<'q, Any, AnyArguments<'q>>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'q: 'async_trait,
'life0: 'async_trait;
fn fetch_all<'q, 'life0, 'async_trait>(
&'life0 self,
query: Query<'q, Any, AnyArguments<'q>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<AnyRow>>> + Send + 'async_trait>>
where Self: 'async_trait,
'q: 'async_trait,
'life0: 'async_trait;
fn fetch_one<'q, 'life0, 'async_trait>(
&'life0 self,
query: Query<'q, Any, AnyArguments<'q>>,
) -> Pin<Box<dyn Future<Output = Result<Option<AnyRow>>> + Send + 'async_trait>>
where Self: 'async_trait,
'q: 'async_trait,
'life0: 'async_trait;
}Expand description
Common database trait
Required Methods§
Sourcefn db_type(&self) -> DatabaseType
fn db_type(&self) -> DatabaseType
Get the database type
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute a query
Sourcefn query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<AnyRow>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<AnyRow>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Query multiple rows
Sourcefn query_one<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AnyRow>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query_one<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AnyRow>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Query one row
Sourcefn ping<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ping<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check health
Sourcefn begin_transaction<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DbTransaction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn begin_transaction<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DbTransaction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Begin a transaction
Sourcefn execute_query<'q, 'life0, 'async_trait>(
&'life0 self,
query: Query<'q, Any, AnyArguments<'q>>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'q: 'async_trait,
'life0: 'async_trait,
fn execute_query<'q, 'life0, 'async_trait>(
&'life0 self,
query: Query<'q, Any, AnyArguments<'q>>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'q: 'async_trait,
'life0: 'async_trait,
Execute a sqlx Query