All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- worker:
PeriodicWorkerruns a handler on a fixed interval, skipping ticks when the previous run is still in progress. Instrumented with Prometheus counters and histograms (periodic_worker_cycles_total,periodic_worker_runs_total,periodic_worker_run_duration_seconds,periodic_worker_skipped_total) and OpenTelemetry traces. - pg:
WithStatementCacheCapacityoption to tune the number of server-side prepared statements pgx caches per connection. Pass0when running behind a transaction-mode connection pooler such as pgbouncer. - pg:
WithDescriptionCacheCapacityoption to tune the statement-description cache used byQueryExecModeCacheDescribe. - pg:
WithDefaultQueryExecModeoption to override pgx's default query execution mode. Use together withWithStatementCacheCapacity(0)andWithDescriptionCacheCapacity(0)for transaction-pooling proxies. - httpserver: Default 30 s read and write timeouts on all servers created by
NewServer. Override with the newWithReadTimeoutandWithWriteTimeoutoptions; pass0to disable.
- pg:
WithApplicationNameoption to set the PostgreSQLapplication_nameruntime parameter, surfacing the client inpg_stat_activity,pg_stat_statements, server logs, andpg_locksfor easier incident attribution.
- httpclient: Retry round tripper with exponential backoff and jitter for transient failures (5xx, 429, and connection errors). Enabled via
WithMaxRetries,WithRetryMinWait, andWithRetryMaxWaitoptions. - pg:
WithMaxConnLifetimeJitteroption to smear connection recycle events and avoid synchronized reconnect storms. Defaults to 5 minutes; pass0to disable. - pg:
WithHealthCheckPeriodoption to tune how often the pool checks idle connections and enforces MinConns/MaxConnIdleTime/MaxConnLifetime. A zero value leaves the pgx default (1 minute) in place.
- pg: TLS configurations produced by
WithTLSandWithUnsecureTLSnow enable a client session cache, allowing reconnects to resume previous TLS sessions and skip the full handshake. Reduces tail latency onpgxpool_acquire_duration_secondsfor WAN-reached databases.
- pg:
WithUnsecureTLSAdd option to connect with unsecure TLS.
- pg:
WithMinPoolSize,WithMaxConnIdleTime, andWithMaxConnLifetimeoptions to tune pgxpool connection lifecycle and reduce acquire tail latency from cold connections.
- httpclient: SSRF protection via a custom dialer that rejects connections to private, loopback, link-local, and other non-public IP ranges.
- pg:
NoRollbackerror type to signal intentional transaction abort without triggering error-level logging.
- pg:
Tx.Savepointcallback now receivespg.Txinstead ofpg.Querier, enabling nested savepoints.
- worker: Generic task polling worker with concurrent processing, observability, and graceful shutdown.
The transaction API has been redesigned to make savepoints explicit
rather than implicit. Previously, WithTx detected a parent
transaction in the context and silently created a savepoint, which
made it hard to reason about whether you were getting a new
transaction or a savepoint. The new design separates the two
operations: WithTx always opens a fresh transaction, and savepoints
are created explicitly via Tx.Savepoint. This gives the type system
a role in enforcing transactional intent — Tx means "you're in a
transaction," Querier means "you can run queries," and the compiler
catches misuse rather than leaving it to runtime.
- pg:
Conninterface renamed toQuerier. All code referencingpg.Connmust be updated topg.Querier. - pg:
ExecFuncis now generic:ExecFunc[Q Querier].WithConnacceptsExecFunc[Querier],WithTxacceptsExecFunc[Tx]. - pg:
WithTxcallback now receivespg.Txinstead ofpg.Conn.TxextendsQuerierwith aSavepointmethod. - pg:
WithTxalways opens a new connection and transaction. It no longer implicitly creates savepoints via context detection. - pg: Removed
WithoutTx— no longer needed sinceWithTxalways starts a fresh transaction. - migrator:
Migration.Applynow takespg.Txinstead ofpg.Querierto make the transactional requirement explicit.
- pg:
Txinterface with explicitSavepoint(ctx, ExecFunc[Querier]) errormethod for creating savepoints within a transaction. - pg:
Querierinterface (renamed fromConn) representing the base capability of running SQL queries.
- pg:
ExecFuncsignature changed fromfunc(Conn) errortofunc(context.Context, Conn) error. All callbacks passed toWithConn,WithTx, andWithAdvisoryLockmust be updated to accept acontext.Contextas the first parameter. The provided context carries the active transaction, enabling savepoint support in nested calls.
- pg: Nested
WithTxcalls now create savepoints instead of independent transactions. If the inner callback fails, only the savepoint is rolled back; the outer transaction remains active. - pg:
WithoutTxfunction to obtain a context with the active transaction removed, useful when a nested call should start an independent transaction.
- Updated dependencies
- Fix trace export failed when attributes contains invalid UTF8 rune
0.1.0 - 2026-02-01
Initial release of the kit library.
- log: Structured logging wrapper around
slogwith OpenTelemetry trace correlation - pg: PostgreSQL client with connection pooling, transactions, advisory locks, and observability
- migrator: File-based SQL migration runner with version tracking
- httpserver: HTTP server with tracing, metrics, and response rendering helpers
- httpclient: HTTP client with pooled/non-pooled transports and telemetry
- worker: Generic worker pool with backpressure and graceful shutdown
- unit: Application lifecycle management with config loading, metrics server, and trace exporter