@@ -5,6 +5,7 @@ use crate::types::Type;
5
5
use postgres_protocol:: message:: frontend;
6
6
use std:: {
7
7
fmt,
8
+ num:: { NonZeroI16 , NonZeroU32 } ,
8
9
sync:: { Arc , Weak } ,
9
10
} ;
10
11
@@ -66,20 +67,28 @@ impl Statement {
66
67
67
68
/// Information about a column of a query.
68
69
pub struct Column {
69
- name : String ,
70
- type_ : Type ,
70
+ pub ( crate ) name : String ,
71
+ pub ( crate ) table_oid : Option < NonZeroU32 > ,
72
+ pub ( crate ) column_id : Option < NonZeroI16 > ,
73
+ pub ( crate ) type_ : Type ,
71
74
}
72
75
73
76
impl Column {
74
- pub ( crate ) fn new ( name : String , type_ : Type ) -> Column {
75
- Column { name, type_ }
76
- }
77
-
78
77
/// Returns the name of the column.
79
78
pub fn name ( & self ) -> & str {
80
79
& self . name
81
80
}
82
81
82
+ /// Returns the OID of the underlying database table.
83
+ pub fn table_oid ( & self ) -> Option < NonZeroU32 > {
84
+ self . table_oid
85
+ }
86
+
87
+ /// Return the column ID within the underlying database table.
88
+ pub fn column_id ( & self ) -> Option < NonZeroI16 > {
89
+ self . column_id
90
+ }
91
+
83
92
/// Returns the type of the column.
84
93
pub fn type_ ( & self ) -> & Type {
85
94
& self . type_
@@ -90,6 +99,8 @@ impl fmt::Debug for Column {
90
99
fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
91
100
fmt. debug_struct ( "Column" )
92
101
. field ( "name" , & self . name )
102
+ . field ( "table_oid" , & self . table_oid )
103
+ . field ( "column_id" , & self . column_id )
93
104
. field ( "type" , & self . type_ )
94
105
. finish ( )
95
106
}
0 commit comments