What problem does it solve?
Go developers writing database interactions with pgx need clear patterns for connection pooling, safe queries, migrations, and transaction handling; this skill provides practical Go pgx usage patterns and examples.
Core Features & Use Cases
- Connection Pool Setup: configure a global pool with min/max conns and lifecycle.
- Query Patterns & Scanning: parameterized queries, proper scanning, and context propagation.
- Transactions & Migrations: multi-step operations with rollback, and SQL migrations as files.
- Null Handling & Error Wrapping: robust handling of nullable columns and wrapped errors for clarity.
- Use Case: building a backend service that performs CRUD and complex transactions against PostgreSQL using pgx.
Quick Start
Create a Go module and implement the pgx-based DB layer following the patterns and examples provided.