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

Both stores implement CodeStore + SessionStore + FormTokenStore + CodeAdminStore and pass the full codlet-conformance suite.

§Atomicity guarantee

Every one-time transition (code claim, form-token consume) uses a single UPDATE … WHERE … AND <guard> checked via rows_affected(). For PostgreSQL, READ COMMITTED isolation + row-level locking means concurrent updates serialise at the row — exactly one wins. No SERIALIZABLE isolation or RETURNING clause is needed or used (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).