Skip to content

Latest commit

 

History

History
134 lines (82 loc) · 6.63 KB

File metadata and controls

134 lines (82 loc) · 6.63 KB

Changelog

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.

[Unreleased]

[0.11.0] - 2026-05-25

Added

  • worker: PeriodicWorker runs 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: WithStatementCacheCapacity option to tune the number of server-side prepared statements pgx caches per connection. Pass 0 when running behind a transaction-mode connection pooler such as pgbouncer.
  • pg: WithDescriptionCacheCapacity option to tune the statement-description cache used by QueryExecModeCacheDescribe.
  • pg: WithDefaultQueryExecMode option to override pgx's default query execution mode. Use together with WithStatementCacheCapacity(0) and WithDescriptionCacheCapacity(0) for transaction-pooling proxies.
  • httpserver: Default 30 s read and write timeouts on all servers created by NewServer. Override with the new WithReadTimeout and WithWriteTimeout options; pass 0 to disable.

[0.10.0] - 2026-05-12

Added

  • pg: WithApplicationName option to set the PostgreSQL application_name runtime parameter, surfacing the client in pg_stat_activity, pg_stat_statements, server logs, and pg_locks for easier incident attribution.

[0.9.0] - 2026-05-12

Added

  • httpclient: Retry round tripper with exponential backoff and jitter for transient failures (5xx, 429, and connection errors). Enabled via WithMaxRetries, WithRetryMinWait, and WithRetryMaxWait options.
  • pg: WithMaxConnLifetimeJitter option to smear connection recycle events and avoid synchronized reconnect storms. Defaults to 5 minutes; pass 0 to disable.
  • pg: WithHealthCheckPeriod option 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.

Changed

  • pg: TLS configurations produced by WithTLS and WithUnsecureTLS now enable a client session cache, allowing reconnects to resume previous TLS sessions and skip the full handshake. Reduces tail latency on pgxpool_acquire_duration_seconds for WAN-reached databases.

[0.8.0] - 2026-05-08

Added

  • pg: WithUnsecureTLS Add option to connect with unsecure TLS.

[0.7.0] - 2026-04-22

Added

  • pg: WithMinPoolSize, WithMaxConnIdleTime, and WithMaxConnLifetime options to tune pgxpool connection lifecycle and reduce acquire tail latency from cold connections.

[0.6.0] - 2026-04-20

Added

  • httpclient: SSRF protection via a custom dialer that rejects connections to private, loopback, link-local, and other non-public IP ranges.

[0.5.0] - 2026-04-07

Added

  • pg: NoRollback error type to signal intentional transaction abort without triggering error-level logging.

[0.4.0] - 2026-04-06

Breaking Changes

  • pg: Tx.Savepoint callback now receives pg.Tx instead of pg.Querier, enabling nested savepoints.

Added

  • worker: Generic task polling worker with concurrent processing, observability, and graceful shutdown.

[0.3.0] - 2026-04-02

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.

Breaking Changes

  • pg: Conn interface renamed to Querier. All code referencing pg.Conn must be updated to pg.Querier.
  • pg: ExecFunc is now generic: ExecFunc[Q Querier]. WithConn accepts ExecFunc[Querier], WithTx accepts ExecFunc[Tx].
  • pg: WithTx callback now receives pg.Tx instead of pg.Conn. Tx extends Querier with a Savepoint method.
  • pg: WithTx always opens a new connection and transaction. It no longer implicitly creates savepoints via context detection.
  • pg: Removed WithoutTx — no longer needed since WithTx always starts a fresh transaction.
  • migrator: Migration.Apply now takes pg.Tx instead of pg.Querier to make the transactional requirement explicit.

Added

  • pg: Tx interface with explicit Savepoint(ctx, ExecFunc[Querier]) error method for creating savepoints within a transaction.
  • pg: Querier interface (renamed from Conn) representing the base capability of running SQL queries.

[0.2.0] - 2026-04-02

Breaking Changes

  • pg: ExecFunc signature changed from func(Conn) error to func(context.Context, Conn) error. All callbacks passed to WithConn, WithTx, and WithAdvisoryLock must be updated to accept a context.Context as the first parameter. The provided context carries the active transaction, enabling savepoint support in nested calls.

Added

  • pg: Nested WithTx calls now create savepoints instead of independent transactions. If the inner callback fails, only the savepoint is rolled back; the outer transaction remains active.
  • pg: WithoutTx function to obtain a context with the active transaction removed, useful when a nested call should start an independent transaction.

Changed

  • Updated dependencies

[0.1.1] - 2026-02-05

Fixed

  • Fix trace export failed when attributes contains invalid UTF8 rune

0.1.0 - 2026-02-01

Initial release of the kit library.

Added

  • log: Structured logging wrapper around slog with 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