pub struct Database { /* private fields */ }Expand description
Shared SQLite database connection wrapper with schema initialization.
Data is isolated by app_id: for file-based databases the effective
path is {stem}_{app_id}{ext} (e.g. data.db with app_id "a1"
opens data_a1.db). In-memory databases are inherently isolated
because each instance gets its own private database.
Implementations§
Source§impl Database
impl Database
Sourcepub fn open(path: impl AsRef<Path>, app_id: &str) -> RustvelloResult<Self>
pub fn open(path: impl AsRef<Path>, app_id: &str) -> RustvelloResult<Self>
Open or create a SQLite database at the given path.
The app_id is embedded in the filename so that different
applications using the same base path get separate database files.
Sourcepub fn in_memory() -> RustvelloResult<Self>
pub fn in_memory() -> RustvelloResult<Self>
Create an in-memory SQLite database (for testing).
In-memory databases are inherently isolated (each Connection owns
a private database), so app_id is accepted for API consistency
but does not affect behavior.
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