pub struct Config {
pub path: String,
pub migrations: Option<String>,
pub busy_timeout: u64,
pub cache_size: i64,
pub mmap_size: u64,
pub journal_mode: JournalMode,
pub synchronous: SynchronousMode,
pub foreign_keys: bool,
pub temp_store: TempStore,
pub pool: Option<PoolConfig>,
}Expand description
Database configuration with sensible defaults for SQLite/libsql.
All fields are optional when deserializing from YAML. Defaults produce
a WAL-mode database at data/app.db with foreign keys enabled.
If migrations is set, SQL migrations from that
directory are applied automatically on connect.
Fields§
§path: StringDatabase file path.
migrations: Option<String>Migration directory. If set, migrations run on connect.
busy_timeout: u64Busy timeout in milliseconds.
cache_size: i64Cache size in KB (applied as PRAGMA cache_size = -N).
mmap_size: u64Memory-mapped I/O size in bytes.
journal_mode: JournalModeWAL journal mode.
synchronous: SynchronousModeSynchronous mode.
foreign_keys: boolForeign key enforcement.
temp_store: TempStoreTemp store location.
pool: Option<PoolConfig>Optional pool configuration for multi-database sharding.
When set, DatabasePool::new can be used
to manage shard databases that share this config’s PRAGMAs and migrations.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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