id_effect_sql
Driver-agnostic SQL client capability for id_effect, aligned with Effect.ts @effect/sql.
Application code talks to Arc<dyn SqlClient> (or the SqlClientService capability); production wires the PostgreSQL driver behind the pg feature, tests use the scriptable in-memory TestSqlClient.
Quick start
use Arc;
use ;
use ;
/// Domain code depends only on the trait.
With the pg feature, swap TestSqlClient for id_effect_sql::pg::PgSqlClient::new(pool) (pool from
pg_pool_from_config) or register provide_pg_sql_client(pool) in a capability Env.
Modules
| Module | Description |
|---|---|
error |
SqlError |
client |
SqlClient, SqlRow, SqlParam, TestSqlClient, transaction_scope |
transaction |
SqlTransaction, with_transaction transaction scope |
pg (feature pg) |
PgSqlClient, PgPoolConfig, pg_pool_from_config, provide_pg_sql_client (formerly id_effect_sql_pg) |
Design
See ADR adr-sql-driver-choice.md and the spec phase-c-sql.md.
Testing
Live PostgreSQL tests (tests/pg.rs, live_postgres_*) read DATABASE_URL. Without a database they print
SKIP … to stderr; with ID_EFFECT_REQUIRE_PG=1 (set by CI whenever it provides a Postgres service) a
missing or unreachable database fails the run instead.
DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/postgres ID_EFFECT_REQUIRE_PG=1 \