crabka_connect_postgres/
model.rs1use crate::PgLsn;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub struct EntityKey {
5 pub table: String,
6 pub columns: Vec<ColumnValue>,
7}
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub enum Operation {
11 Insert,
12 Update,
13 Delete,
14}
15
16#[derive(Debug, Clone, PartialEq, Eq)]
17pub struct EntityDifference {
18 pub table: String,
19 pub key: EntityKey,
20 pub op: Operation,
21 pub before: Vec<ColumnValue>,
22 pub after: Vec<ColumnValue>,
23 pub lsn: PgLsn,
24 pub txid: Option<i64>,
25 pub commit_timestamp_ms: Option<i64>,
26 pub schema: TableSchema,
27}
28
29#[derive(Debug, Clone, PartialEq, Eq)]
30pub struct TableSchema {
31 pub schema: String,
32 pub table: String,
33 pub columns: Vec<ColumnSchema>,
34}
35
36#[derive(Debug, Clone, PartialEq, Eq)]
37pub struct ColumnSchema {
38 pub name: String,
39 pub type_name: String,
40 pub key: bool,
41}
42
43#[derive(Debug, Clone, PartialEq, Eq)]
44pub struct ColumnValue {
45 pub name: String,
46 pub value: ScalarValue,
47}
48
49#[derive(Debug, Clone, PartialEq, Eq)]
50pub enum ScalarValue {
51 Null,
52 UnchangedToast,
53 Bool(bool),
54 Int(i64),
55 Float(String),
56 Text(String),
57 Bytes(Vec<u8>),
58}