d_rocket_engine_postgres 2.0.0
d_rocket_engine_postgres: ^2.0.0 copied to clipboard
PostgreSQL engine for d_rocket 2.0: implements the DbEngine contract over the Postgres v3 wire protocol (via package:postgres). Use it for multi-user / multi-machine backends; for local single-user ap [...]
Changelog #
All notable changes to d_rocket_engine_postgres
are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
2.0.0 — 2026-06-17 #
Initial release. The second engine package in the d_rocket 2.0 multi-engine architecture.
-
PostgresEngine(DbEnginecontract). The registry slot where the engine plugs in.name = 'postgres',isAvailable = true(pure Dart, no native lib to load). -
PostgresQueryProvider(AsyncQueryProvidercontract). The wire-protocol client (package:postgres) wrapped in the d_rocket async interface. SupportsselectAsync,executeAsync,beginTransactionAsync,commitAsync,rollbackAsync,disposeAsync. -
PgDbfacade +_PostgresContext(DbContext). The user-facing facade for the Postgres engine. Mirrors the SQLite engine'sDbclass. -
dRocketPostgres()registration helper. The single entry point the consumer calls once at app startup. -
Auto-migrator integration. The
d_rocketcore's auto-migrator is engine-agnostic; this package just wires theentityMetasand exposesdb.runAutoMigrations()/db.pendingSchemaDiff(). -
?-placeholder auto-rewrite to$N. The dev can use?placeholders in raw SQL; the provider rewrites them to the Postgres wire-protocol$1, $2, ...form on everyexecuteAsync/selectAsynccall. -
Error wrapping. All wire-protocol exceptions are caught and re-raised as
DatabaseException(in d_rocket core) with the originalPgExceptionas thecause. TheServerException.code(Postgres SQL state) is included in themessagefor easier diagnosis. -
lastInsertRowIdAsyncthrows with a clear message. Postgres has no per-connection "last insert id"; the standard way is theINSERT ... RETURNING <pk>clause. The provider throwsDatabaseExceptionwith a pointer to the RETURNING pattern. -
Test helper with
TEST_PG_URLskip. The test suite is gated on theTEST_PG_URLenv var; tests are skipped (not failed) in environments without a Postgres instance.
Deferred to 2.1 (and beyond) #
- SQL LINQ
Queryable<T>— thedb.set<T>().where(...)extension. 90% of the SQLite translator's logic is reusable; the remaining 10% (placeholder conversion, RETURNING clause, SERIAL / BIGSERIAL handling) is a 2.1 feature. - Built-in connection pooling — use
package:postgres_pooldirectly in 2.0. LISTEN/NOTIFYreactive queries — shipped in 2.0.0 (viaPostgresListenNotify, the pure-Dart wire-protocol client). Native async LISTEN via libpq FFI is a 2.2 feature (the 2.0 implementation polls the socket for notifications, which is fine for typical workloads but blocks the connection under burst traffic).- libpq FFI variant — for cases that need libpq's extra features (COPY, async LISTEN).