mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-08 01:22:57 +00:00

* feat: add flowy-database2 * chore: config type option data * chore: impl type option * feat: config group * fix: group compile * feat: add sort * chore: setting * chore: insert with specific type * chore: custom group * chore: rename any map * chore: use group setting * chore: update * chore: open database event * chore: update database editor * chore: update * chore: update view editor * chore: update * chore: update view editor * chore: sort feat * chore: update handler * chore: update * chore: config handler event * feat: impl handlers * feat: impl handlers * chore: layout setting * feat: impl handlers * chore: remove flowy-folder ref * chore: integrate flowy-database2 * feat: get cell * chore: create database with data * chore: create view * chore: fix dart compile * fix: some bugs * chore: update * chore: merge develop * chore: fix warning * chore: integrate rocksdb * fix: rocksdb compile errros * fix: update cell * chore: update the bundle identifier * fix: create row * fix: switch to field * fix: duplicate grid * test: migrate tests * test: migrate tests * test: update test * test: migrate tests * chore: add patch
73 lines
1.9 KiB
Rust
73 lines
1.9 KiB
Rust
use collab_database::rows::RowId;
|
|
|
|
use flowy_database2::entities::CellChangesetPB;
|
|
|
|
use crate::database::database_editor::DatabaseEditorTest;
|
|
|
|
pub enum CellScript {
|
|
UpdateCell {
|
|
changeset: CellChangesetPB,
|
|
is_err: bool,
|
|
},
|
|
}
|
|
|
|
pub struct DatabaseCellTest {
|
|
inner: DatabaseEditorTest,
|
|
}
|
|
|
|
impl DatabaseCellTest {
|
|
pub async fn new() -> Self {
|
|
let inner = DatabaseEditorTest::new_grid().await;
|
|
Self { inner }
|
|
}
|
|
|
|
pub async fn run_scripts(&mut self, scripts: Vec<CellScript>) {
|
|
for script in scripts {
|
|
self.run_script(script).await;
|
|
}
|
|
}
|
|
|
|
pub async fn run_script(&mut self, script: CellScript) {
|
|
// let grid_manager = self.sdk.grid_manager.clone();
|
|
// let pool = self.sdk.user_session.db_pool().unwrap();
|
|
// let rev_manager = self.editor.rev_manager();
|
|
// let _cache = rev_manager.revision_cache().await;
|
|
|
|
match script {
|
|
CellScript::UpdateCell {
|
|
changeset,
|
|
is_err: _,
|
|
} => {
|
|
self
|
|
.editor
|
|
.update_cell_with_changeset(
|
|
&self.view_id,
|
|
RowId::from(changeset.row_id),
|
|
&changeset.field_id,
|
|
changeset.cell_changeset,
|
|
)
|
|
.await;
|
|
}, // CellScript::AssertGridRevisionPad => {
|
|
// sleep(Duration::from_millis(2 * REVISION_WRITE_INTERVAL_IN_MILLIS)).await;
|
|
// let mut grid_rev_manager = grid_manager.make_grid_rev_manager(&self.grid_id, pool.clone()).unwrap();
|
|
// let grid_pad = grid_rev_manager.load::<GridPadBuilder>(None).await.unwrap();
|
|
// println!("{}", grid_pad.delta_str());
|
|
// }
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::ops::Deref for DatabaseCellTest {
|
|
type Target = DatabaseEditorTest;
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
&self.inner
|
|
}
|
|
}
|
|
|
|
impl std::ops::DerefMut for DatabaseCellTest {
|
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
|
&mut self.inner
|
|
}
|
|
}
|