aboutsummaryrefslogtreecommitdiff
path: root/server/src/database.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/database.rs')
-rw-r--r--server/src/database.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/server/src/database.rs b/server/src/database.rs
new file mode 100644
index 0000000..3ba8c52
--- /dev/null
+++ b/server/src/database.rs
@@ -0,0 +1,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 })
+ }
+}