Cell Values
KalamCellValue is the typed wrapper around each cell in query and subscription results.
Instead of parsing raw serde_json::Value at every call site, use the accessor methods on KalamCellValue.
Quick example
Row shapes
| Context | Type |
|---|---|
QueryResponse::rows_as_maps() | Vec<HashMap<String, KalamCellValue>> |
QueryResponse::rows() | Vec<Vec<KalamCellValue>> (positional) |
LiveRowsEvent::Rows | Vec<HashMap<String, KalamCellValue>> |
Low-level ChangeEvent rows | Named or positional depending on event variant |
Prefer named maps (rows_as_maps, live row maps) for application code.
Creating values
Type guards
KalamCellValue derefs to serde_json::Value, so you can use standard JSON checks:
Prefer the typed accessors below for SQL column semantics.
Typed accessors
| Method | SQL types |
|---|---|
as_text() | Text |
as_small_int() | SmallInt |
as_int() | Int |
as_big_int() | BigInt (handles string-encoded JSON for precision) |
as_float() / as_double() | Float / Double |
as_decimal() | Decimal |
as_boolean() | Boolean |
as_timestamp() | Timestamp (epoch value) |
BigInt and large integers are often serialized as JSON strings — accessors handle both numeric and string forms.
Raw access
Live subscription rows
FILE columns
FILE values deserialize to structured JSON. Use file-specific helpers instead of parsing raw JSON by hand.
.as_file() -> Option<FileRef>
Parse a FILE column into table-agnostic metadata:
FileRef alone does not include namespace/table — you need those to build download URLs.
.as_bound_file(&TableId) -> Option<BoundFileRef>
Parse and attach table context in one step. Reuse one TableId when parsing many rows from the same table:
See FILE Columns & Uploads for uploads, BoundFileRef, and download APIs.
Accessor summary
| Method | Returns | Use for |
|---|---|---|
as_text() | Option<&str> | Text columns |
as_int() / as_big_int() | numeric options | Integer columns |
as_file() | Option<FileRef> | FILE metadata without table context |
as_bound_file(&TableId) | Option<BoundFileRef> | FILE metadata + download context |