diff --git a/core/types.rs b/core/types.rs index 113e0ce09..9a679f35e 100644 --- a/core/types.rs +++ b/core/types.rs @@ -176,6 +176,12 @@ impl From for Text { } } +impl From for String { + fn from(value: Text) -> Self { + String::from_utf8(value.value).unwrap() + } +} + impl Display for TextRef { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.as_str()) @@ -956,6 +962,12 @@ impl ImmutableRecord { } } + pub fn from_bin_record(payload: Vec) -> Self { + Self { + payload: Value::Blob(payload), + } + } + // TODO: inline the complete record parsing code here. // Its probably more efficient. pub fn get_values(&self) -> Vec { @@ -2436,6 +2448,22 @@ impl RawSlice { } } +#[derive(Debug)] +pub enum DatabaseChangeType { + Delete, + Update { bin_record: Vec }, + Insert { bin_record: Vec }, +} + +#[derive(Debug)] +pub struct DatabaseChange { + pub change_id: i64, + pub change_time: u64, + pub change: DatabaseChangeType, + pub table_name: String, + pub id: i64, +} + #[derive(Debug)] pub struct WalInsertInfo { pub page_no: usize,