pgxext is a comprehensive collection of PostgreSQL extensions for the pgx v5 driver, designed to simplify database operations, cluster management, and testing workflows.
- Cluster Management: Primary-replica topology with automatic read/write routing
- Enhanced Querying: Simplified scanning with struct binding support
- Transaction Management: Advanced transaction handling with timeout controls
- Testing Utilities: Transaction-based testing for isolated test environments
go get github.com/MrEhbr/pgxextpgxext is organized into three main packages:
- cluster/ - Primary-replica database abstraction
- conn/ - Enhanced querying & transactions
- txdb/ - Testing utilities
Abstracts primary-replica physical database topologies as a single logical database. Automatically routes reads to replicas and writes to primary with round-robin load balancing.
Simplifies querying and scanning with automatic struct binding, transaction context management, and configurable timeouts.
Single transaction-based database wrapper for fast, isolated functional tests without database reloads.
See the examples/ directory for complete working examples:
examples/cluster/- Primary-replica cluster usageexamples/conn/- Enhanced querying and transactionsexamples/txdb/- Testing with transaction isolation
# Set up test database
export PGXEXT_TEST_DATABASE_DSN="postgres://user:password@localhost:5432/testdb"
# Run tests with coverage
just test
# Start development database
just devTests require a PostgreSQL database. If PGXEXT_TEST_DATABASE_DSN is not set, integration tests are automatically skipped.
This project uses Just as a command runner:
just test- Run tests with race detection and coveragejust lint- Run golangci-lint with comprehensive rulesjust fmt- Format code using golines and gofumptjust dev- Start development database
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Run
just lintandjust test - Submit a pull request
© 2025 Alexey Burmistrov
Licensed under the Apache License, Version 2.0 (LICENSE). See the COPYRIGHT file for more details.
SPDX-License-Identifier: Apache-2.0