mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-04 08:54:20 +01:00
add CDC types
This commit is contained in:
@@ -176,6 +176,12 @@ impl From<String> for Text {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Text> 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<u8>) -> Self {
|
||||
Self {
|
||||
payload: Value::Blob(payload),
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: inline the complete record parsing code here.
|
||||
// Its probably more efficient.
|
||||
pub fn get_values(&self) -> Vec<RefValue> {
|
||||
@@ -2436,6 +2448,22 @@ impl RawSlice {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum DatabaseChangeType {
|
||||
Delete,
|
||||
Update { bin_record: Vec<u8> },
|
||||
Insert { bin_record: Vec<u8> },
|
||||
}
|
||||
|
||||
#[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,
|
||||
|
||||
Reference in New Issue
Block a user