Function hyper_scripter::db::get_pool

source ·
pub async fn get_pool(need_journal: &mut bool) -> Result<(SqlitePool, bool)>
Expand description

有可能改變 need_journal 的值。 若為初始化,或資料庫已被 journal 鎖住,則不論如何都使用 journal

Examples found in repository?
src/util/init_repo.rs (line 18)
12
13
14
15
16
17
18
19
20
pub async fn init_env(mut need_journal: bool) -> Result<(DBEnv, bool)> {
    async fn init_historian() -> Result<Historian> {
        let h = Historian::new(path::get_home().to_owned()).await?;
        Ok(h)
    }
    let ((pool, init), historian) =
        try_join!(crate::db::get_pool(&mut need_journal), init_historian())?;
    Ok((DBEnv::new(pool, historian, need_journal), init))
}