chore: grid block meta editor

This commit is contained in:
appflowy
2022-03-11 21:36:00 +08:00
parent 9a791974b4
commit e11176436d
32 changed files with 1887 additions and 529 deletions

View File

@ -160,3 +160,39 @@ macro_rules! impl_sql_integer_expression {
}
};
}
#[macro_export]
macro_rules! impl_rev_state_map {
($target:ident) => {
impl std::convert::From<i32> for $target {
fn from(value: i32) -> Self {
match value {
0 => $target::Sync,
1 => $target::Ack,
o => {
tracing::error!("Unsupported rev state {}, fallback to RevState::Local", o);
$target::Sync
}
}
}
}
impl std::convert::From<$target> for RevisionState {
fn from(s: $target) -> Self {
match s {
$target::Sync => RevisionState::Sync,
$target::Ack => RevisionState::Ack,
}
}
}
impl std::convert::From<RevisionState> for $target {
fn from(s: RevisionState) -> Self {
match s {
RevisionState::Sync => $target::Sync,
RevisionState::Ack => $target::Ack,
}
}
}
};
}

View File

@ -21,6 +21,17 @@ table! {
}
}
table! {
grid_meta_rev_table (id) {
id -> Integer,
object_id -> Text,
base_rev_id -> BigInt,
rev_id -> BigInt,
data -> Binary,
state -> Integer,
}
}
table! {
grid_rev_table (id) {
id -> Integer,
@ -102,6 +113,7 @@ table! {
allow_tables_to_appear_in_same_query!(
app_table,
doc_table,
grid_meta_rev_table,
grid_rev_table,
kv_table,
rev_table,