Skip to content

Commit 5bc7d0e

Browse files
committed
expose row buffer size
1 parent f898c2e commit 5bc7d0e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

tokio-postgres/src/row.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ impl Row {
204204
Err(Error::from_sql(Box::new(WrongFormat {}), idx))
205205
}
206206
}
207+
208+
/// Row byte size
209+
pub fn body_len(&self) -> usize {
210+
self.body.buffer().len()
211+
}
207212
}
208213

209214
impl AsName for SimpleColumn {

tokio-postgres/tests/test/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ async fn query_raw_txt() {
277277

278278
assert_eq!(rows.len(), 1);
279279
assert_eq!(rows[0].get::<_, &str>(0), "42");
280+
assert!(rows[0].body_len() > 0);
280281
}
281282

282283
#[tokio::test]

0 commit comments

Comments
 (0)