use sqlite::Connection; use std::{path::Path, rc::Rc, sync::RwLock}; pub struct Database { connection: Rc>, } impl Database { // Constructors pub fn new(path: &Path) -> Self { Self { connection: match Connection::open(path) { Ok(connection) => Rc::new(RwLock::new(connection)), Err(reason) => panic!("{reason}"), }, } } // Getters pub fn connection(&self) -> &Rc> { &self.connection } }