# README
PGH
A Go package that provides helper functions to combine the power of:
- Squirrel - SQL builder
- pgx - PGX PostgreSQL driver
- database/sql - Golang SQL package
- scany - Scanning query results into Golang structs
Purpose and Core Functionality
The PGH project is a Go package that provides helper functions to combine the power of several libraries:
- Squirrel: SQL builder
- pgx: PGX PostgreSQL driver
- database/sql: Golang SQL package
- scany: Scanning query results into Golang structs
Requirements
- Go 1.23 or higher
Key Features and Capabilities
- Helper functions for building SQL queries using Squirrel
- Functions for executing SQL queries and handling results using pgx
- Support for various query types, including modification queries, select queries, and batch queries
- Options for adding conditions, sorting, searching, and pagination to queries
- PostgreSQL error handling with specific error code support
Additional Functionality
- Transaction Manager (txmgr) - A database-agnostic transaction management system that provides clean and consistent handling of database transactions, isolation levels, and nested transactions
- Transaction Manager implementation for PostgreSQL (pgdb) - A PostgreSQL-specific implementation of the ITransactionInformer and ITransactionBeginner interfaces from the txmgr package
- Client-side sharding (buckets) - Support for distributing data across multiple database shards using virtual buckets (schemas) for PostgreSQL databases
Getting Started
# general functionality
go get github.com/n-r-w/pgh/v2
# pgx + squirrel + scany
go get github.com/n-r-w/pgh/v2/px
# database/sql + squirrel + scany
go get github.com/n-r-w/pgh/v2/pq