Nathan.fooo f9e7b5ffa4
feat: reload UI (#2999)
* chore: reload folder

* chore: reload folder

* chore: init sync

* chore: update tables

* chore: update database

* chore: load row

* chore: update

* chore: reload row

* test: fit test

* chore: retry

* chore: support batch fetch

* chore: enable sync

* chore: sync switch

* chore: sync switch

* chore: migration user data

* chore: migrate data

* chore: migrate folder

* chore: save user email

* chore: refresh user profile

* chore: fix test

* chore: delete translation files

* test: clippy format
2023-07-14 13:37:13 +08:00

67 lines
1.3 KiB
Rust

use collab_database::rows::{RowId, RowMeta};
use collab_database::views::DatabaseLayout;
#[derive(Debug, Clone)]
pub enum DatabaseRowEvent {
InsertRow(InsertedRow),
UpdateRow(UpdatedRow),
DeleteRow(RowId),
Move {
deleted_row_id: RowId,
inserted_row: InsertedRow,
},
}
#[derive(Debug, Clone)]
pub struct InsertedRow {
pub row_meta: RowMeta,
pub index: Option<i32>,
pub is_new: bool,
}
#[derive(Debug, Clone)]
pub struct UpdatedRow {
pub row_id: String,
pub height: Option<i32>,
/// Indicates which cells were updated.
pub field_ids: Vec<String>,
/// The meta of row was updated if this is Some.
pub row_meta: Option<RowMeta>,
}
impl UpdatedRow {
pub fn new(row_id: &str) -> Self {
Self {
row_id: row_id.to_string(),
height: None,
field_ids: vec![],
row_meta: None,
}
}
pub fn with_field_ids(mut self, field_ids: Vec<String>) -> Self {
self.field_ids = field_ids;
self
}
pub fn with_height(mut self, height: i32) -> Self {
self.height = Some(height);
self
}
pub fn with_row_meta(mut self, row_meta: RowMeta) -> Self {
self.row_meta = Some(row_meta);
self
}
}
#[derive(Debug, Clone)]
pub struct CreateDatabaseViewParams {
pub name: String,
pub view_id: String,
pub layout_type: DatabaseLayout,
}