gmarche-rs/src/db.rs

16 lines
312 B
Rust

use sled::{Db, IVec, Tree};
use std::path::Path;
const DB_DIR: &'static str = "db";
pub struct Dbs {
db: Db,
}
pub fn load_dbs(path: &Path) -> Dbs {
//std::fs::create_dir_all(path.join(DB_DIR)).expect("Cannot create db dir");
let db = sled::open(path.join(DB_DIR)).expect("Cannot open db");
Dbs { db }
}