Skip to content

Commit 9f08f49

Browse files
committed
Expose column count on individual rows to make it possible to iterate columns just like on Rows.
Side-note: I feel like there's an opportunity to make Rows and Row more alike.
1 parent da7b7dc commit 9f08f49

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libsql/src/rows.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ impl Row {
130130
self.inner.column_str(idx)
131131
}
132132

133+
/// Get the count of columns in this set of rows.
134+
pub fn column_count(&self) -> usize {
135+
self.inner.column_count()
136+
}
137+
133138
/// Fetch the name of the column at the provided index.
134139
pub fn column_name(&self, idx: i32) -> Option<&str> {
135140
self.inner.column_name(idx)
@@ -284,7 +289,6 @@ pub(crate) trait RowInner: fmt::Debug {
284289
fn column_str(&self, idx: i32) -> Result<&str>;
285290
fn column_name(&self, idx: i32) -> Option<&str>;
286291
fn column_type(&self, idx: i32) -> Result<ValueType>;
287-
#[allow(dead_code)]
288292
fn column_count(&self) -> usize;
289293
}
290294

0 commit comments

Comments
 (0)