pub struct DbConfig {
pub url: String,
pub max_connections: Option<u32>,
pub min_connections: Option<u32>,
pub connect_timeout_secs: u64,
pub max_lifetime_secs: u64,
pub sqlite_wal: bool,
pub run_migrations: bool,
}Expand description
[database] section — connection pool configuration.
[database]
url = "sqlite:///var/lib/kipuka/kipuka.db"
max_connections = 10
min_connections = 2Fields§
§url: StringDatabase connection URL.
Examples:
"sqlite:///var/lib/kipuka/kipuka.db"— file-backed SQLite"sqlite::memory:"— in-memory SQLite (testing only)"postgres://user:pass@host/kipuka"— PostgreSQL"mariadb://user:pass@host/kipuka"— MariaDB
Supports "env:VAR_NAME" to read the URL from an environment variable.
max_connections: Option<u32>Maximum number of connections in the pool.
Default: 10 for PostgreSQL/MariaDB, 1 for SQLite (WAL mode serializes writes regardless of pool size).
min_connections: Option<u32>Minimum number of idle connections maintained in the pool.
Default: none (sqlx default applies).
connect_timeout_secs: u64Connection acquisition timeout in seconds.
Default: 30.
max_lifetime_secs: u64Maximum connection lifetime in seconds before recycling.
Default: 3600 (1 hour).
sqlite_wal: boolEnable SQLite WAL (Write-Ahead Logging) mode.
WAL provides better concurrent read performance by allowing readers and writers to proceed simultaneously. Enabled by default for SQLite; ignored for other backends.
run_migrations: boolRun pending migrations at startup.
Default: true.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DbConfig
impl<'de> Deserialize<'de> for DbConfig
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>,
Auto Trait Implementations§
impl Freeze for DbConfig
impl RefUnwindSafe for DbConfig
impl Send for DbConfig
impl Sync for DbConfig
impl Unpin for DbConfig
impl UnsafeUnpin for DbConfig
impl UnwindSafe for DbConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more