pub enum ChangeEvent {
Ack {
subscription_id: String,
total_rows: u32,
batch_control: BatchControl,
schema: Vec<SchemaField>,
},
InitialDataBatch {
subscription_id: String,
rows: Vec<HashMap<String, KalamCellValue>>,
batch_control: BatchControl,
},
Insert {
subscription_id: String,
rows: Vec<HashMap<String, KalamCellValue>>,
},
Update {
subscription_id: String,
rows: Vec<HashMap<String, KalamCellValue>>,
old_rows: Vec<HashMap<String, KalamCellValue>>,
},
Delete {
subscription_id: String,
old_rows: Vec<HashMap<String, KalamCellValue>>,
},
Error {
subscription_id: String,
code: String,
message: String,
},
Unknown {
raw: Value,
},
}Expand description
Change event received via WebSocket subscription.
Variants§
Ack
Acknowledgement of subscription registration with batch info
Fields
batch_control: BatchControlBatch control information
schema: Vec<SchemaField>Schema describing the columns in the subscription result
InitialDataBatch
Initial data batch (paginated loading)
Fields
rows: Vec<HashMap<String, KalamCellValue>>Rows in this batch (named columns)
batch_control: BatchControlBatch control information
Insert
Insert notification
Fields
rows: Vec<HashMap<String, KalamCellValue>>Inserted rows (named columns)
Update
Update notification
Fields
rows: Vec<HashMap<String, KalamCellValue>>Updated rows (only changed columns + PK/_seq).
The changed user columns are exactly the non-system keys in each row:
row.keys().filter(|k| !k.starts_with('_'))
old_rows: Vec<HashMap<String, KalamCellValue>>Previous row values (only changed columns + PK/_seq)
Delete
Delete notification
Fields
old_rows: Vec<HashMap<String, KalamCellValue>>Deleted rows (named columns)
Error
Error notification from the server
Fields
Unknown
Unknown payload (kept for logging/diagnostics)
Implementations§
Source§impl ChangeEvent
impl ChangeEvent
Sourcepub fn subscription_id(&self) -> Option<&str>
pub fn subscription_id(&self) -> Option<&str>
Returns the subscription ID for this event, if any
Sourcepub fn from_server_message(msg: ServerMessage) -> Option<ChangeEvent>
pub fn from_server_message(msg: ServerMessage) -> Option<ChangeEvent>
Convert a ServerMessage into a ChangeEvent.
Returns None for auth-only messages (AuthSuccess, AuthError) that
are not subscription events.
Sourcepub fn to_server_message(&self) -> ServerMessage
pub fn to_server_message(&self) -> ServerMessage
Convert this event back to a ServerMessage.
Trait Implementations§
Source§impl Clone for ChangeEvent
impl Clone for ChangeEvent
Source§fn clone(&self) -> ChangeEvent
fn clone(&self) -> ChangeEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more