Skip to main content

text_document_common/
snapshot.rs

1// Generated by Qleany v1.4.8 from snapshot.tera
2
3use crate::types::EntityId;
4use serde::{Deserialize, Serialize};
5
6/// Snapshot of rows from a single entity table, stored as postcard-serialized bytes.
7#[derive(Debug, Clone, Default, Serialize, Deserialize)]
8pub struct TableSnapshot {
9    pub table_name: String,
10    pub rows: Vec<(EntityId, Vec<u8>)>,
11}
12
13/// Snapshot of entries from a single junction table.
14#[derive(Debug, Clone, Default, Serialize, Deserialize)]
15pub struct JunctionSnapshot {
16    pub table_name: String,
17    pub entries: Vec<(EntityId, Vec<EntityId>)>,
18}
19
20/// Complete snapshot of a single entity table level: the entity rows plus all
21/// forward and backward junction tables that reference them.
22#[derive(Debug, Clone, Default, Serialize, Deserialize)]
23pub struct TableLevelSnapshot {
24    pub entity_rows: TableSnapshot,
25    pub forward_junctions: Vec<JunctionSnapshot>,
26    pub backward_junctions: Vec<JunctionSnapshot>,
27}
28
29/// Recursive snapshot of an entity and all its strong-relationship children.
30/// Used for delete undo/redo: snapshot before delete, restore on undo.
31#[derive(Debug, Clone, Default, Serialize, Deserialize)]
32pub struct EntityTreeSnapshot {
33    pub table_data: TableLevelSnapshot,
34    pub children: Vec<EntityTreeSnapshot>,
35}