@@ -2,6 +2,7 @@ use crate::query::RowStream;
2
2
use crate :: types:: { BorrowToSql , ToSql , Type } ;
3
3
use crate :: { Client , Error , Row , Statement , ToStatement , Transaction } ;
4
4
use async_trait:: async_trait;
5
+ use postgres_protocol:: Oid ;
5
6
6
7
mod private {
7
8
pub trait Sealed { }
@@ -76,6 +77,9 @@ pub trait GenericClient: private::Sealed {
76
77
/// Like `Client::transaction`.
77
78
async fn transaction ( & mut self ) -> Result < Transaction < ' _ > , Error > ;
78
79
80
+ /// Query for type information
81
+ async fn get_type ( & self , oid : Oid ) -> Result < Type , Error > ;
82
+
79
83
/// Returns a reference to the underlying `Client`.
80
84
fn client ( & self ) -> & Client ;
81
85
}
@@ -165,6 +169,11 @@ impl GenericClient for Client {
165
169
self . transaction ( ) . await
166
170
}
167
171
172
+ /// Query for type information
173
+ async fn get_type ( & self , oid : Oid ) -> Result < Type , Error > {
174
+ self . get_type ( oid) . await
175
+ }
176
+
168
177
fn client ( & self ) -> & Client {
169
178
self
170
179
}
@@ -257,6 +266,11 @@ impl GenericClient for Transaction<'_> {
257
266
self . transaction ( ) . await
258
267
}
259
268
269
+ /// Query for type information
270
+ async fn get_type ( & self , oid : Oid ) -> Result < Type , Error > {
271
+ self . client ( ) . get_type ( oid) . await
272
+ }
273
+
260
274
fn client ( & self ) -> & Client {
261
275
self . client ( )
262
276
}
0 commit comments