pub struct DatabaseConfig {
pub path: PathBuf,
pub journal_mode: String,
pub busy_timeout: u64,
pub synchronous: String,
pub foreign_keys: bool,
pub cache_size: i64,
pub max_rows: usize,
pub migrations_dir: Option<PathBuf>,
}Expand description
SQLite settings ([database] section).
Written as a table — path is the only required key; the pragma
defaults are what a server should have shipped with: WAL so readers do
not block the writer, a busy timeout so contention is a brief wait
rather than an error, and foreign keys actually enforced.
Fields§
§path: PathBufPath to the SQLite file.
journal_mode: StringJournal mode. "wal" lets readers run alongside one writer;
"delete" (SQLite’s default) serializes everything. "keep" leaves
whatever the file already uses, which is the safe choice for a
database other tools also open.
busy_timeout: u64Milliseconds a statement waits on a locked database before failing
with SQLITE_BUSY.
synchronous: Stringsynchronous pragma. "normal" is the correct pairing with WAL:
durable across an application crash, and only at risk from a power
loss mid-checkpoint.
foreign_keys: boolEnforce foreign-key constraints. SQLite leaves this off by default,
which surprises everyone who wrote a REFERENCES clause.
cache_size: i64cache_size pragma, per connection. Negative values are KiB.
max_rows: usizeMost rows a single nitr.db:query may return; a larger result is
an error naming this setting. Rows are materialized in memory, so
this is the ceiling on what one query can allocate.
migrations_dir: Option<PathBuf>Directory holding NNN_name.sql migrations. Unset looks for
migrations/ in the working directory and ignores it when absent.
Implementations§
Trait Implementations§
Source§impl Clone for DatabaseConfig
impl Clone for DatabaseConfig
Source§impl Debug for DatabaseConfig
impl Debug for DatabaseConfig
Source§impl<'de> Deserialize<'de> for DatabaseConfig
impl<'de> Deserialize<'de> for DatabaseConfig
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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