delta/change/mod.rs
1/// Represents the type of a database transaction.
2///
3/// `TransactionType` can be:
4/// - `Insert`: Represents an insert operation.
5/// - `Update`: Represents an update operation.
6/// - `Delete`: Represents a delete operation.
7#[repr(u8)]
8#[derive(Debug, PartialEq, Eq, Clone, Copy)]
9pub enum TransactionType {
10 Insert,
11 Update,
12 Delete,
13}
14
15/// Represents the value stored in a database cell.
16///
17/// `Value` can be:
18/// - `Int`: An integer value.
19/// - `Float`: A floating-point value.
20/// - `String`: A string value.
21/// - `None`: A null value.
22// TODO add blob
23#[derive(Debug, Clone)]
24pub enum Value {
25 Int(i64),
26 Float(f64),
27 String(String),
28 None,
29}
30
31/// Represents a change in the database.
32///
33/// `Change` contains detailed information about a specific change in the database,
34/// including the affected table, row, column, and the new value.
35#[derive(Debug, Clone)]
36pub struct Change {
37 pub id: String,
38 pub table_name: String,
39 pub row_id: String,
40 pub column_name: String,
41 pub value: Value,
42 pub cell_version: u64,
43 pub table_version: u64,
44 pub db_version: u64,
45 pub node_id: String,
46 pub transaction_type: TransactionType,
47}