pub struct Database { /* private fields */ }Expand description
Core database handle. Wraps an Arc<Mutex<Connection>> for write access.
§Usage
use seshat_storage::Database;
let db = Database::open("seshat.db").unwrap();Implementations§
Source§impl Database
impl Database
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self, StorageError>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, StorageError>
Opens (or creates) a SQLite database at path, enables WAL mode,
and applies any pending migrations.
For in-memory databases (testing), pass ":memory:".
Sourcepub fn connection(&self) -> &Arc<Mutex<Connection>>
pub fn connection(&self) -> &Arc<Mutex<Connection>>
Returns a reference to the underlying connection wrapped in Arc<Mutex<_>>.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Database
impl RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnsafeUnpin for Database
impl UnwindSafe for Database
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more