pub struct QueryResult {
pub schema: Vec<SchemaField>,
pub rows: Option<Vec<Vec<KalamCellValue>>>,
pub named_rows: Option<Vec<HashMap<String, KalamCellValue>>>,
pub row_count: usize,
pub message: Option<String>,
pub as_user: Option<String>,
}Expand description
Individual query result within a SQL response.
Fields§
§schema: Vec<SchemaField>Schema describing the columns in the result set. Each field contains: name, data_type (KalamDataType), and index.
rows: Option<Vec<Vec<KalamCellValue>>>The result rows as arrays of values (ordered by schema index).
Populated by the server; cleared client-side once named_rows is built.
named_rows: Option<Vec<HashMap<String, KalamCellValue>>>Rows as maps keyed by column name (column → KalamCellValue).
Populated client-side by [populate_named_rows] from schema + rows.
When present, SDKs should prefer this over positional rows.
row_count: usizeNumber of rows affected or returned.
message: Option<String>Optional message for non-query statements.
as_user: Option<String>Effective user identifier this statement executed as.
Implementations§
Source§impl QueryResult
impl QueryResult
Sourcepub fn column_names(&self) -> Vec<String>
pub fn column_names(&self) -> Vec<String>
Get column names from schema.
Sourcepub fn row_as_map(
&self,
row_idx: usize,
) -> Option<HashMap<String, KalamCellValue>>
pub fn row_as_map( &self, row_idx: usize, ) -> Option<HashMap<String, KalamCellValue>>
Get a row as a HashMap by index (for convenience).
Sourcepub fn rows_as_maps(&self) -> Vec<HashMap<String, KalamCellValue>>
pub fn rows_as_maps(&self) -> Vec<HashMap<String, KalamCellValue>>
Get all rows as HashMaps (column name → value).
Sourcepub fn populate_named_rows(&mut self)
pub fn populate_named_rows(&mut self)
Build named_rows from schema + rows, then clear positional rows.
After this call the result contains only the named-column representation
so SDKs can iterate named_rows directly instead of performing the
schema → map transformation themselves.
Trait Implementations§
Source§impl Clone for QueryResult
impl Clone for QueryResult
Source§fn clone(&self) -> QueryResult
fn clone(&self) -> QueryResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more