use super::{CdcEvent, Position};
use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum Event {
Cdc(CdcEvent),
FullSync { table: String, data: Value },
Insert {
table: String,
new_data: Value,
position: Option<Position>,
},
Update {
table: String,
old_data: Value,
new_data: Value,
position: Option<Position>,
},
Delete {
table: String,
old_data: Value,
position: Option<Position>,
},
Checkpoint(Position),
Heartbeat,
}
#[derive(Debug, Clone)]
pub struct CdcEventWithPosition {
pub event: CdcEvent,
pub position: Option<Position>,
}
impl CdcEventWithPosition {
pub fn new(event: CdcEvent, position: Option<Position>) -> Self {
Self { event, position }
}
}