Skip to content

Commit dbd4d02

Browse files
committed
Address review comment to rename query_with_param_types to query_typed
1 parent f00ed42 commit dbd4d02

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

tokio-postgres/src/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ impl Client {
382382
/// use tokio_postgres::types::Type;
383383
/// use futures_util::{pin_mut, TryStreamExt};
384384
///
385-
/// let rows = client.query_with_param_types(
385+
/// let rows = client.query_typed(
386386
/// "SELECT foo FROM bar WHERE biz = $1 AND baz = $2",
387387
/// &[(&"first param", Type::TEXT), (&2i32, Type::INT4)],
388388
/// ).await?;
@@ -394,7 +394,7 @@ impl Client {
394394
/// # Ok(())
395395
/// # }
396396
/// ```
397-
pub async fn query_with_param_types(
397+
pub async fn query_typed(
398398
&self,
399399
statement: &str,
400400
params: &[(&(dyn ToSql + Sync), Type)],
@@ -406,7 +406,7 @@ impl Client {
406406
.map(|(param, param_type)| (*param as _, param_type.clone()))
407407
}
408408

409-
query::query_with_param_types(&self.inner, statement, slice_iter(params))
409+
query::query_typed(&self.inner, statement, slice_iter(params))
410410
.await?
411411
.try_collect()
412412
.await

tokio-postgres/src/generic_client.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ pub trait GenericClient: private::Sealed {
5656
I: IntoIterator<Item = P> + Sync + Send,
5757
I::IntoIter: ExactSizeIterator;
5858

59-
/// Like [`Client::query_with_param_types`]
60-
async fn query_with_param_types(
59+
/// Like [`Client::query_typed`]
60+
async fn query_typed(
6161
&self,
6262
statement: &str,
6363
params: &[(&(dyn ToSql + Sync), Type)],
@@ -146,12 +146,12 @@ impl GenericClient for Client {
146146
self.query_raw(statement, params).await
147147
}
148148

149-
async fn query_with_param_types(
149+
async fn query_typed(
150150
&self,
151151
statement: &str,
152152
params: &[(&(dyn ToSql + Sync), Type)],
153153
) -> Result<Vec<Row>, Error> {
154-
self.query_with_param_types(statement, params).await
154+
self.query_typed(statement, params).await
155155
}
156156

157157
async fn prepare(&self, query: &str) -> Result<Statement, Error> {
@@ -244,12 +244,12 @@ impl GenericClient for Transaction<'_> {
244244
self.query_raw(statement, params).await
245245
}
246246

247-
async fn query_with_param_types(
247+
async fn query_typed(
248248
&self,
249249
statement: &str,
250250
params: &[(&(dyn ToSql + Sync), Type)],
251251
) -> Result<Vec<Row>, Error> {
252-
self.query_with_param_types(statement, params).await
252+
self.query_typed(statement, params).await
253253
}
254254

255255
async fn prepare(&self, query: &str) -> Result<Statement, Error> {

tokio-postgres/src/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ where
6161
})
6262
}
6363

64-
pub async fn query_with_param_types<'a, P, I>(
64+
pub async fn query_typed<'a, P, I>(
6565
client: &Arc<InnerClient>,
6666
query: &str,
6767
params: I,

tokio-postgres/src/transaction.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,13 @@ impl<'a> Transaction<'a> {
227227
query::query_portal(self.client.inner(), portal, max_rows).await
228228
}
229229

230-
/// Like `Client::query_with_param_types`.
231-
pub async fn query_with_param_types(
230+
/// Like `Client::query_typed`.
231+
pub async fn query_typed(
232232
&self,
233233
statement: &str,
234234
params: &[(&(dyn ToSql + Sync), Type)],
235235
) -> Result<Vec<Row>, Error> {
236-
self.client.query_with_param_types(statement, params).await
236+
self.client.query_typed(statement, params).await
237237
}
238238

239239
/// Like `Client::copy_in`.

tokio-postgres/tests/test/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ async fn deferred_constraint() {
954954
}
955955

956956
#[tokio::test]
957-
async fn query_with_param_types_no_transaction() {
957+
async fn query_typed_no_transaction() {
958958
let client = connect("user=postgres").await;
959959

960960
client
@@ -971,7 +971,7 @@ async fn query_with_param_types_no_transaction() {
971971
.unwrap();
972972

973973
let rows: Vec<tokio_postgres::Row> = client
974-
.query_with_param_types(
974+
.query_typed(
975975
"SELECT name, age, 'literal', 5 FROM foo WHERE name <> $1 AND age < $2 ORDER BY age",
976976
&[(&"alice", Type::TEXT), (&50i32, Type::INT4)],
977977
)
@@ -993,7 +993,7 @@ async fn query_with_param_types_no_transaction() {
993993
}
994994

995995
#[tokio::test]
996-
async fn query_with_param_types_with_transaction() {
996+
async fn query_typed_with_transaction() {
997997
let mut client = connect("user=postgres").await;
998998

999999
client
@@ -1011,7 +1011,7 @@ async fn query_with_param_types_with_transaction() {
10111011
let transaction = client.transaction().await.unwrap();
10121012

10131013
let rows: Vec<tokio_postgres::Row> = transaction
1014-
.query_with_param_types(
1014+
.query_typed(
10151015
"INSERT INTO foo (name, age) VALUES ($1, $2), ($3, $4), ($5, $6) returning name, age",
10161016
&[
10171017
(&"alice", Type::TEXT),
@@ -1038,7 +1038,7 @@ async fn query_with_param_types_with_transaction() {
10381038
);
10391039

10401040
let rows: Vec<tokio_postgres::Row> = transaction
1041-
.query_with_param_types(
1041+
.query_typed(
10421042
"SELECT name, age, 'literal', 5 FROM foo WHERE name <> $1 AND age < $2 ORDER BY age",
10431043
&[(&"alice", Type::TEXT), (&50i32, Type::INT4)],
10441044
)

0 commit comments

Comments
 (0)