Merge pull request #980 from aDogCalledSpot/batch-execute-in-generic-client

tokio_postgres: add batch_execute to GenericClient
This commit is contained in:
Steven Fackler 2023-01-08 09:07:33 -05:00 committed by GitHub
commit c3590261bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,6 +69,9 @@ 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 +152,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 +239,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()
}