oca_rs/repositories/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
pub mod capture_base_cache_repo;
pub use capture_base_cache_repo::*;
pub mod oca_bundle_fts_repo;
pub use oca_bundle_fts_repo::*;
pub mod oca_bundle_cache_repo;
pub use oca_bundle_cache_repo::*;

use std::path::PathBuf;

#[derive(Clone)]
pub struct SQLiteConfig {
    pub path: Option<PathBuf>,
}

impl SQLiteConfig {
    pub fn build() -> SQLiteConfigBuilder {
        SQLiteConfigBuilder { path: None }
    }
}

pub struct SQLiteConfigBuilder {
    path: Option<PathBuf>,
}

impl SQLiteConfigBuilder {
    pub fn path(mut self, path: PathBuf) -> Self {
        self.path = Some(path);
        self
    }

    pub fn finalize(&self) -> Result<SQLiteConfig, String> {
        Ok(SQLiteConfig {
            path: self.path.clone(),
        })
    }

    pub fn unwrap(&self) -> SQLiteConfig {
        self.finalize().unwrap()
    }
}