glite/config
Types
Configuration for opening a SQLite database
pub type Config {
Config(
path: String,
timeout: Int,
busy_timeout: Int,
journal_mode: JournalMode,
synchronous: SynchronousMode,
foreign_keys: Bool,
pragmas: List(#(String, String)),
)
}
Constructors
-
Config( path: String, timeout: Int, busy_timeout: Int, journal_mode: JournalMode, synchronous: SynchronousMode, foreign_keys: Bool, pragmas: List(#(String, String)), )Arguments
- path
-
Database file path. Use “:memory:” for in-memory database.
- timeout
-
Timeout in milliseconds for actor calls
- busy_timeout
-
Busy timeout in milliseconds (how long to wait for locks)
- journal_mode
-
Journal mode (WAL recommended for concurrent access)
- synchronous
-
Synchronous mode
- foreign_keys
-
Foreign key enforcement
- pragmas
-
Extra PRAGMAs to execute on connection open
Connection configuration for SQLite Journal mode for the database
pub type JournalMode {
Wal
Delete
Memory
Off
}
Constructors
-
WalWrite-Ahead Logging (recommended for concurrent reads)
-
DeleteTraditional rollback journal
-
MemoryIn-memory journal (fastest, no crash recovery)
-
OffNo journal (no crash recovery, no rollback)
Synchronous mode
pub type SynchronousMode {
Full
Normal
SyncOff
}
Constructors
-
FullFull fsync on every commit (safest, slowest)
-
NormalFsync at critical moments (good balance)
-
SyncOffNo fsync (fastest, risk of corruption on OS crash)
Values
pub fn journal_mode(config: Config, mode: JournalMode) -> Config
pub fn synchronous(
config: Config,
mode: SynchronousMode,
) -> Config