pub struct Database { /* private fields */ }Expand description
Wrapper around a rusqlite::Connection with project-standard pragmas
applied and migrations run.
Implementations§
Source§impl Database
impl Database
Sourcepub fn open(path: &Path) -> Result<Database>
pub fn open(path: &Path) -> Result<Database>
Open or create a SQLite database at path, apply pragmas, and run
any pending migrations.
Tilde-expansion is applied to path.
§Errors
TgaError::DbErrorfor SQLite-level failures.TgaError::MigrationErrorif a migration fails.
Sourcepub fn open_in_memory() -> Result<Database>
pub fn open_in_memory() -> Result<Database>
Sourcepub fn connection(&self) -> &Connection
pub fn connection(&self) -> &Connection
Borrow the underlying connection (read-only).
Sourcepub fn connection_mut(&mut self) -> &mut Connection
pub fn connection_mut(&mut self) -> &mut Connection
Borrow the underlying connection mutably.
Sourcepub fn journal_mode(&self) -> Result<String>
pub fn journal_mode(&self) -> Result<String>
Return the active journal mode (e.g. "wal" or "memory").
§Errors
Returns TgaError::DbError if the pragma query fails.
Sourcepub fn schema_version(&self) -> Result<i64>
pub fn schema_version(&self) -> Result<i64>
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