Expand description
§wabot-feature-pg
Postgres foundation — port of wabot-ts/src/feature/pg. Provides:
PgConfig/PgDatabase— pool construction fromDATABASE_URL+WABOT_PG_*, registrable as a DI singleton.PgJsonbStore— the JSONB document store every framework table uses (id/created_at/data+ promoted columns), created on first use.PgLocker— distributedwabot_core::lock::Lockeron advisory locks; the piece that makes multi-node scheduling safe.
§What’s ported and what isn’t
wabot-ts’s feature/pg is much larger — PgCrudRepository,
projections, audit log, idempotency, rate limiter, columnar SQL,
the migration runner. This crate ports the document-storage +
locking core the framework itself needs, which is what the async
and chat-bot addons sit on. The relational/columnar strategy and
its migration tooling are a separate piece of work; nothing here
forecloses it.
ⓘ
let db = PgDatabase::connect(PgConfig::from_env()?).await?;
c.register_instance::<PgDatabase>(Arc::new(db));Re-exports§
pub use columns::PgColumnsStore;pub use indexes::build_index_ddl;pub use infra::PgAuditLog;pub use infra::PgIdempotency;pub use infra::PgRateLimiter;pub use query_sql::build_query_sql;pub use query_sql::BuiltQuery;pub use query_sql::FieldPlacement;pub use query_sql::QuerySqlError;pub use config::PgConfig;pub use error::PgError;pub use error::PgResult;pub use jsonb::PgJsonbStore;pub use jsonb::PromotedColumn;pub use locker::PgLocker;pub use migrations::MigrationRunner;pub use migrations::MigrationStatus;pub use projection::PgProjectionRuntime;pub use transaction::in_transaction;pub use transaction::with_transaction;
Modules§
- columns
- Relational storage: every field is a real typed column. Port of
PgColumnsRepository+pgColumnarSqlin wabot-ts. - config
- Pool construction + tuning. Port of
pgPoolConfig.ts. - error
- Error type shared by the pg feature and its addons.
- indexes
- Index declarations → Postgres DDL. Port of
wabot-ts/src/feature/pg/pgIndexes.ts. - infra
- Postgres-backed idempotency, rate limiting and audit log. Ports of
PgIdempotency,PgRateLimiterandPgAuditLog. - jsonb
PgJsonbStore— Postgres document storage for entities.- locker
PgLocker— distributedLockeron Postgres advisory locks. Port ofPgLocker.ts+PgLockKey.ts.- migrations
- Plain-SQL migrations. Port of
wabot-ts/src/feature/pg/migrations/MigrationRunner.ts. - projection
- Postgres backend for projections. Port of
wabot-ts/src/feature/pg/PgProjectionRuntime.ts. - query_
sql - Turning a
Queryinto SQL. Port ofbuildQuerySql.ts. - repository
PgJsonbStoreas aCrudRepository.- transaction
- Transactions. Port of
withPgClient+withPgTransaction+PgTransactionAdapterin wabot-ts.
Structs§
- PgDatabase
- Owns the connection pool. A thin newtype rather than using
sqlx::PgPooldirectly, because the DI container keys on the concrete type and a barePgPoolwould collide with any other pool an app registers.