ic_db_cli/browse.rs
1//! Private Explorer fixture transport. Integer and identity components cross JS as exact text.
2use serde::{Deserialize, Serialize};
3
4/// One bounded lookup or live page.
5#[derive(Serialize, Deserialize)]
6pub struct Request {
7 /// Fixture store selector.
8 pub store: String,
9 /// Qualified entity name.
10 pub entity: String,
11 /// Continuation for a live page.
12 pub after: Option<Vec<u8>>,
13 /// Exact primary key components, in declared order.
14 pub key: Option<Vec<String>>,
15 /// Maximum returned rows.
16 pub rows: u8,
17 /// Encoded database value budget.
18 pub bytes: u16,
19}
20/// Fixture projection for the browser.
21#[derive(Serialize, Deserialize)]
22pub struct Page {
23 /// Hex schema fingerprint.
24 pub fingerprint: String,
25 /// Visible column names in row order.
26 pub columns: Vec<String>,
27 /// Rows in primary order.
28 pub rows: Vec<Vec<Cell>>,
29 /// Continuation for the same projection.
30 pub next: Option<Vec<u8>>,
31}
32/// Schema supplies scalar types. Separate tags preserve absent, truncated and literal text.
33#[derive(Serialize, Deserialize)]
34pub enum Cell {
35 /// Missing optional value.
36 Absent,
37 /// Value omitted to fit the budget.
38 Truncated,
39 /// Lossless text for the declared scalar.
40 Scalar(String),
41 /// List or ordered set elements.
42 Sequence(Vec<Self>),
43 /// Ordered key/value pairs.
44 Map(Vec<(Self, Self)>),
45 /// Named record fields.
46 Record(Vec<(String, Self)>),
47 /// Selected enum case and optional payload.
48 Variant(String, Option<Box<Self>>),
49}