Expand description
cratefield-adapter-sqlite: the Database port over rusqlite
(bundled SQLite). Native only — never compiled to wasm. Used by every
module test and viable for a single-node self-hosted deployment
(ADR 0004).
A rusqlite::Connection is Send but !Sync; the harness requires
Arc<dyn Database> to be Send + Sync, so the connection lives
behind a mutex. This is connection guarding, not request state; the
scoped clippy allow follows the policy documented in the workspace
clippy.toml.
§cratefield-adapter-sqlite
The Database port over rusqlite (bundled SQLite) for the Factory
Zero harness. Native only — never compiled to wasm. Used by every module
test and by cratefield-testing, and viable for a single-node self-hosted
deployment (ADR 0004).
use cratefield_adapter_sqlite::SqliteDatabase;
let db = SqliteDatabase::in_memory()?; // or ::open("venture.db")
db.apply_migrations("email-signup", &migrations)?; // tracked in harness_migrations
// ... through Arc<dyn Database> as usualbatchruns all statements in one transaction (atomic).apply_migrations(module, &[SqlMigration])is idempotent: each migration is tracked under<module>/<id>in aharness_migrationstable and applied in its own transaction.- The
rusqliteconnection is!Sync, so it lives behind a mutex; this is connection guarding, not request state (see the workspaceclippy.tomlpolicy).
MIT. Built in the open for Cratefield, a Factory Zero venture.
Structs§
- Sqlite
Database - An open SQLite database (file path or
:memory:).