Skip to main content

activecube_rs/response/
mod.rs

1/// A row returned from a SQL query, represented as an ordered map
2/// of column name → JSON value. Database-agnostic.
3pub type RowMap = indexmap::IndexMap<String, serde_json::Value>;
4
5/// Result of a cube query execution.
6#[derive(Debug, Clone)]
7pub struct QueryResult {
8    pub rows: Vec<RowMap>,
9    pub row_count: usize,
10    pub sql: String,
11}
12
13impl QueryResult {
14    pub fn new(rows: Vec<RowMap>, sql: String) -> Self {
15        let row_count = rows.len();
16        Self { rows, row_count, sql }
17    }
18
19    pub fn is_empty(&self) -> bool {
20        self.rows.is_empty()
21    }
22}