add batch_execute to generic client

This commit is contained in:
Ari Breitkreuz 2023-01-08 12:21:42 +01:00
parent 0c056148d0
commit e38e435665

View File

@ -69,6 +69,10 @@ pub trait GenericClient: private::Sealed {
/// Like `Client::transaction`.
async fn transaction(&mut self) -> Result<Transaction<'_>, Error>;
/// Like `Client::batch_execute`.
async fn batch_execute(&self, query: &str) -> Result<(), Error>;
/// Returns a reference to the underlying `Client`.
fn client(&self) -> &Client;
}
@ -149,6 +153,10 @@ impl GenericClient for Client {
self.transaction().await
}
async fn batch_execute(&self, query: &str) -> Result<(), Error> {
self.batch_execute(query).await
}
fn client(&self) -> &Client {
self
}
@ -232,6 +240,10 @@ impl GenericClient for Transaction<'_> {
self.transaction().await
}
async fn batch_execute(&self, query: &str) -> Result<(), Error> {
self.batch_execute(query).await
}
fn client(&self) -> &Client {
self.client()
}