File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,11 @@ use crate::message::DataRow;
4
4
use crate :: statement:: PgStatementMetadata ;
5
5
use crate :: value:: PgValueFormat ;
6
6
use crate :: { PgColumn , PgValueRef , Postgres } ;
7
- use std:: sync:: Arc ;
8
-
9
7
pub ( crate ) use sqlx_core:: row:: Row ;
8
+ use sqlx_core:: type_checking:: TypeChecking ;
9
+ use sqlx_core:: value:: ValueRef ;
10
+ use std:: fmt:: Debug ;
11
+ use std:: sync:: Arc ;
10
12
11
13
/// Implementation of [`Row`] for PostgreSQL.
12
14
pub struct PgRow {
@@ -48,3 +50,23 @@ impl ColumnIndex<PgRow> for &'_ str {
48
50
. map ( |v| * v)
49
51
}
50
52
}
53
+
54
+ impl Debug for PgRow {
55
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
56
+ write ! ( f, "PgRow " ) ?;
57
+
58
+ let mut debug_map = f. debug_map ( ) ;
59
+ for ( index, column) in self . columns ( ) . iter ( ) . enumerate ( ) {
60
+ if let Ok ( value) = self . try_get_raw ( index) {
61
+ debug_map. entry (
62
+ & column. name ,
63
+ & Postgres :: fmt_value_debug ( & <PgValueRef as ValueRef >:: to_owned ( & value) ) ,
64
+ ) ;
65
+ } else {
66
+ debug_map. entry ( & column. name , & format ! ( "decode error: {error:?}" ) ) ;
67
+ }
68
+ }
69
+
70
+ debug_map. finish ( )
71
+ }
72
+ }
You can’t perform that action at this time.
0 commit comments