Expand description
Database extension: one URL-driven Db over SQLite and Postgres (sqlx Any),
module-owned dual-dialect migrations, and a deterministic ?→$n translator
(sqlx’s Any driver does NOT translate placeholders; ours is quote-blind and
safe because generated SQL never embeds string literals).
Re-exports§
pub use sea_query;pub use sea_query_binder;pub use sqlx;
Structs§
- Db
- The database dependency: a cloneable pool handle. Register app-wide with
App::new().extend(db)(or.provide(db)—extendis the §6 seam). - Migration
- One migration, both dialects. Generated apps embed these via the tool-owned
app/src/migrations.rs; modules own the .sql files (spec §5 anatomy). - Owned
Migration - Runtime-loaded migration (CLI
jerrycan db migratereads module files from disk). The owned twin ofMigration; both delegate to the same runner.
Enums§
- Backend
- Which engine the pool speaks. Generated code branches on this for the few statements that genuinely differ (insert-id strategies, DDL).
Functions§
- db_
error - Map any sqlx error to a stable JC code without leaking internals; the underlying detail goes to stderr for the operator. Unique-key violations are the client’s fault (a re-POSTed id), not a server fault — they map to 409 JC0409 so duplicate writes can’t pollute 5xx alerting.
- translate_
placeholders ?→$1, $2, …for Postgres; identity for SQLite. Quote-blind by design: generated SQL never embeds string literals (binds carry all values).