pub struct DatabaseConfig {
pub path: PathBuf,
pub max_connections: u32,
pub connection_timeout: Duration,
pub create_if_missing: bool,
pub enable_wal: bool,
pub cache_size: i32,
pub foreign_keys: bool,
}Expand description
Database configuration options.
Fields§
§path: PathBufPath to the SQLite database file.
max_connections: u32Maximum number of connections in the pool.
connection_timeout: DurationConnection timeout.
create_if_missing: boolWhether to create the database if it doesn’t exist.
enable_wal: boolEnable WAL mode for better concurrent read performance.
cache_size: i32Cache size in pages (negative = KB).
foreign_keys: boolEnable foreign key constraints.
Implementations§
Source§impl DatabaseConfig
impl DatabaseConfig
Sourcepub fn with_path(path: impl Into<PathBuf>) -> Self
pub fn with_path(path: impl Into<PathBuf>) -> Self
Create a config with a specific database path.
Sourcepub fn with_max_connections(self, count: u32) -> Self
pub fn with_max_connections(self, count: u32) -> Self
Set maximum connections.
Sourcepub fn with_cache_size_mb(self, mb: i32) -> Self
pub fn with_cache_size_mb(self, mb: i32) -> Self
Set cache size in megabytes.
Trait Implementations§
Source§impl Clone for DatabaseConfig
impl Clone for DatabaseConfig
Source§fn clone(&self) -> DatabaseConfig
fn clone(&self) -> DatabaseConfig
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 DatabaseConfig
impl Debug for DatabaseConfig
Auto Trait Implementations§
impl Freeze for DatabaseConfig
impl RefUnwindSafe for DatabaseConfig
impl Send for DatabaseConfig
impl Sync for DatabaseConfig
impl Unpin for DatabaseConfig
impl UnsafeUnpin for DatabaseConfig
impl UnwindSafe for DatabaseConfig
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