Skip to content

Commit c359026

Browse files
authored
Merge pull request sfackler#980 from aDogCalledSpot/batch-execute-in-generic-client
tokio_postgres: add batch_execute to GenericClient
2 parents 0c05614 + 383fd50 commit c359026

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tokio-postgres/src/generic_client.rs

+11
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ pub trait GenericClient: private::Sealed {
6969
/// Like `Client::transaction`.
7070
async fn transaction(&mut self) -> Result<Transaction<'_>, Error>;
7171

72+
/// Like `Client::batch_execute`.
73+
async fn batch_execute(&self, query: &str) -> Result<(), Error>;
74+
7275
/// Returns a reference to the underlying `Client`.
7376
fn client(&self) -> &Client;
7477
}
@@ -149,6 +152,10 @@ impl GenericClient for Client {
149152
self.transaction().await
150153
}
151154

155+
async fn batch_execute(&self, query: &str) -> Result<(), Error> {
156+
self.batch_execute(query).await
157+
}
158+
152159
fn client(&self) -> &Client {
153160
self
154161
}
@@ -232,6 +239,10 @@ impl GenericClient for Transaction<'_> {
232239
self.transaction().await
233240
}
234241

242+
async fn batch_execute(&self, query: &str) -> Result<(), Error> {
243+
self.batch_execute(query).await
244+
}
245+
235246
fn client(&self) -> &Client {
236247
self.client()
237248
}

0 commit comments

Comments
 (0)