Skip to content

Commit

Permalink
iterator: Add get_column_specs() to RowIterator
Browse files Browse the repository at this point in the history
QueryResult has a field called col_specs which
contains information about the selected columns.

Make the same information avaialble when using an iterator.

Signed-off-by: Jan Ciolek <[email protected]>
  • Loading branch information
cvybhu committed Oct 4, 2021
1 parent ff21488 commit 6bf7182
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scylla/src/transport/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::cql_to_rust::{FromRow, FromRowError};
use crate::frame::{
response::{
result,
result::{Row, Rows},
result::{ColumnSpec, Row, Rows},
Response,
},
value::SerializedValues,
Expand Down Expand Up @@ -212,6 +212,11 @@ impl RowIterator {
&self.warnings
}

/// Returns specification of row columns
pub fn get_column_specs(&self) -> &[ColumnSpec] {
&self.current_page.metadata.col_specs
}

fn is_current_page_exhausted(&self) -> bool {
self.current_row_idx >= self.current_page.rows.len()
}
Expand Down Expand Up @@ -371,6 +376,11 @@ impl<RowT> TypedRowIterator<RowT> {
pub fn get_warnings(&self) -> &[String] {
self.row_iterator.get_warnings()
}

/// Returns specification of row columns
pub fn get_column_specs(&self) -> &[ColumnSpec] {
self.row_iterator.get_column_specs()
}
}

/// Couldn't get next typed row from the iterator
Expand Down

0 comments on commit 6bf7182

Please sign in to comment.