Runs a query and collects all rows as JSON objects. On SQL errors returns the error message so handlers can surface it in the payload's `error` field (mirroring the Python APIs, which never 500 on a bad/missing DB).
(
conn: &Connection,
sql: &str,
params: impl libsql::params::IntoParams,
)
| 45 | /// the error message so handlers can surface it in the payload's `error` |
| 46 | /// field (mirroring the Python APIs, which never 500 on a bad/missing DB). |
| 47 | pub(crate) async fn query_rows( |
| 48 | conn: &Connection, |
| 49 | sql: &str, |
| 50 | params: impl libsql::params::IntoParams, |
| 51 | ) -> std::result::Result<Vec<Value>, String> { |
| 52 | let rows = conn.query(sql, params).await.map_err(|e| e.to_string())?; |
| 53 | collect_rows(rows).await.map_err(|e| e.to_string()) |
| 54 | } |
| 55 | |
| 56 | /// Runs a scalar `SELECT COUNT(*)`-style query; errors and missing rows |
| 57 | /// collapse to 0 (these feed overview cards, not critical paths). |
no test coverage detected