pub struct SqliteConfig {
pub path: DatabasePath,
pub foreign_keys: bool,
pub wal_mode: bool,
pub busy_timeout_ms: Option<u32>,
pub cache_size: Option<i32>,
pub synchronous: SynchronousMode,
pub journal_mode: JournalMode,
}Expand description
SQLite database configuration.
Fields§
§path: DatabasePathDatabase path (or “:memory:” for in-memory).
foreign_keys: boolEnable foreign keys.
wal_mode: boolEnable WAL mode.
busy_timeout_ms: Option<u32>Busy timeout in milliseconds.
cache_size: Option<i32>Cache size (in pages, negative for KB).
synchronous: SynchronousModeSynchronous mode.
journal_mode: JournalModeJournal mode.
Implementations§
Source§impl SqliteConfig
impl SqliteConfig
Sourcepub fn file(path: impl AsRef<Path>) -> Self
pub fn file(path: impl AsRef<Path>) -> Self
Create a new configuration for a file-based database.
Sourcepub fn from_url(url: impl AsRef<str>) -> SqliteResult<Self>
pub fn from_url(url: impl AsRef<str>) -> SqliteResult<Self>
Parse a SQLite URL into configuration.
Supported formats:
sqlite::memory:- In-memory databasesqlite://path/to/db.sqlite- File-based databasesqlite:///absolute/path/db.sqlite- Absolute pathfile:path/to/db.sqlite- Alternative format
Sourcepub fn path(self, path: DatabasePath) -> Self
pub fn path(self, path: DatabasePath) -> Self
Set the database path.
Sourcepub fn foreign_keys(self, enabled: bool) -> Self
pub fn foreign_keys(self, enabled: bool) -> Self
Enable or disable foreign keys.
Sourcepub fn busy_timeout(self, ms: u32) -> Self
pub fn busy_timeout(self, ms: u32) -> Self
Set the busy timeout in milliseconds.
Sourcepub fn cache_size(self, size: i32) -> Self
pub fn cache_size(self, size: i32) -> Self
Set the cache size.
Sourcepub fn synchronous(self, mode: SynchronousMode) -> Self
pub fn synchronous(self, mode: SynchronousMode) -> Self
Set the synchronous mode.
Sourcepub fn journal_mode(self, mode: JournalMode) -> Self
pub fn journal_mode(self, mode: JournalMode) -> Self
Set the journal mode.
Trait Implementations§
Source§impl Clone for SqliteConfig
impl Clone for SqliteConfig
Source§fn clone(&self) -> SqliteConfig
fn clone(&self) -> SqliteConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SqliteConfig
impl Debug for SqliteConfig
Auto Trait Implementations§
impl Freeze for SqliteConfig
impl RefUnwindSafe for SqliteConfig
impl Send for SqliteConfig
impl Sync for SqliteConfig
impl Unpin for SqliteConfig
impl UnwindSafe for SqliteConfig
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