Skip to main content

Crate codlet_sqlx

Crate codlet_sqlx 

Source
Expand description

SQLite and PostgreSQL storage adapters for codlet (RFC-011, RFC-034).

§Backends

FeatureTypeConnectionUse case
sqlite (default)SqliteStore"sqlite::memory:", "sqlite:path/to/db"Local dev, single-server
postgresPostgresStorepostgres://…Multi-instance production

Enable one or both backends:

# SQLite only (default — no extra flags needed):
codlet-sqlx = { version = "…" }

# PostgreSQL only — SQLite driver not compiled:
codlet-sqlx = { version = "…", default-features = false, features = ["postgres"] }

# Both backends simultaneously:
codlet-sqlx = { version = "…", features = ["sqlite", "postgres"] }

§Atomicity guarantee

Every one-time transition (code claim, form-token consume) uses a single UPDATE … WHERE … AND <guard> followed by rows_affected(). For PostgreSQL, READ COMMITTED + row-level locking means concurrent updates serialise at the row — exactly one wins. No SERIALIZABLE or RETURNING needed (RFC-034 §7).

§Conformance

All stores pass the codlet-conformance suite including the concurrent claim race test (RFC-022, RFC-023).

Re-exports§

pub use migration::run_migrations;

Modules§

admin
CodeAdminStore implementation for SqliteStore.
code
SQLite implementation of codlet_core::store::code::CodeStore.
migration
Migration runner for codlet SQLite tables (RFC-011 §10.4).
session
SQLite implementation of codlet_core::store::session::SessionStore.
token
SQLite implementation of codlet_core::store::token::FormTokenStore.

Structs§

SqliteStore
A handle wrapping a sqlx::SqlitePool that implements all codlet store traits (RFC-011).