Expand description
Database configuration types.
This module contains the canonical definitions of all database configuration structures used throughout the system. These types are deserialized directly from Figment configuration.
§Configuration Precedence Rules
The database configuration system follows a strict precedence hierarchy when merging global server configurations with module-specific overrides:
| Priority | Source | Description | Example |
|---|---|---|---|
| 1 (Highest) | Module params map | Key-value parameters in module config | params: {synchronous: "FULL"} |
| 2 | Module DSN query params | Parameters in module-level DSN | sqlite://file.db?synchronous=NORMAL |
| 3 | Module fields | Individual connection fields | host: "localhost", port: 5432 |
| 4 | Module DSN base | Core DSN without query params | postgres://user:pass@host/db |
| 5 | Server params map | Key-value parameters in server config | Global server params |
| 6 | Server DSN query params | Parameters in server-level DSN | Server DSN query string |
| 7 | Server fields | Individual connection fields in server | Server host, port, etc. |
| 8 (Lowest) | Server DSN base | Core server DSN without query params | Base server connection string |
§Merge Rules
- Field Precedence: Module fields always override server fields
- DSN Precedence: Module DSN overrides server DSN completely
- Params Merging:
paramsmaps are merged, with module params taking precedence - Pool Configuration: Module pool config overrides server pool config entirely
SQLitePaths:file/pathfields are module-only and never inherited from servers
§Conflict Detection
The system validates configurations and returns [DbError::ConfigConflict] for:
SQLiteDSN with server fields (host/port)- Non-SQLite DSN with
SQLitefields (file/path) - Both
fileandpathspecified forSQLite SQLitefields mixed with server connection fields
Structs§
- DbConn
Config - Reusable DB connection config for both global servers and modules. DSN must be a FULL, valid DSN if provided (dsn crate compliant).
- Global
Database Config - Global database configuration with server-based DBs.
- PoolCfg
Enums§
- DbEngine
Cfg - Serializable engine selector for configuration.