ModKit Database abstraction crate.
This crate provides a unified interface for working with different databases
(SQLite, PostgreSQL, MySQL) through SQLx, with optional SeaORM integration.
It emphasizes typed connection options over DSN string manipulation and
implements strict security controls (e.g., SQLite PRAGMA whitelist).
Features
pg,mysql,sqlite: enableSQLxbackendssea-orm: addSeaORMintegration for type-safe operations
New Architecture
The crate now supports:
- Typed
DbConnectOptionsusing sqlxConnectOptions(no DSN string building) - Per-module database factories with configuration merging
SQLitePRAGMA whitelist for security- Environment variable expansion in passwords and DSNs
Example (DbManager API)
use ;
use ;
use PathBuf;
use Arc;
// Create configuration using Figment
let figment = new
.merge;
// Create DbManager
let home_dir = from;
let db_manager = new;
// Use in runtime with DbOptions::Manager(db_manager)
// Modules can then use: ctx.db_required_async().await?