AppFlowy/frontend/rust-lib/flowy-grid/src/services/persistence/mod.rs
2022-07-20 18:27:12 +08:00

18 lines
466 B
Rust

use flowy_database::{ConnectionPool, DBConnection};
use flowy_error::FlowyError;
use std::sync::Arc;
pub mod block_index;
pub mod kv;
pub mod migration;
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)
}
}