AppFlowy/frontend/rust-lib/flowy-grid/src/services/persistence/mod.rs

18 lines
466 B
Rust
Raw Normal View History

2022-04-05 06:25:07 +00:00
use flowy_database::{ConnectionPool, DBConnection};
use flowy_error::FlowyError;
use std::sync::Arc;
pub mod block_index;
pub mod kv;
2022-07-20 10:27:12 +00:00
pub mod migration;
2022-04-05 06:25:07 +00:00
pub trait GridDatabase: Send + Sync {
fn db_pool(&self) -> Result<Arc<ConnectionPool>, FlowyError>;
fn db_connection(&self) -> Result<DBConnection, FlowyError> {
let pool = self.db_pool()?;
let conn = pool.get().map_err(|e| FlowyError::internal().context(e))?;
Ok(conn)
}
}