aboutsummaryrefslogtreecommitdiff
path: root/server/src/database.rs
blob: 3ba8c52ca6a55acf360c0d6b8b1a6851ecdea94b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
use anyhow::Context;

#[derive(Debug)]
pub struct Database {
    pub db: sled::Db,
}

impl Database {
    pub fn open(path: &str) -> Result<Self, anyhow::Error> {
        let db = sled::open(path).context("opening database")?;
        Ok(Self { db })
    }
}