What problem does it solve?
Provide clear, production-ready patterns for database access in Go to avoid connection leaks, unsafe queries, improper transaction handling, and brittle migrations that cause outages or data corruption.
Core Features & Use Cases
- Connection management: Explicit pool sizing, connection lifetimes, and proactive pinging to prevent overload and stale connections.
- Query safety and patterns: Parameterized queries, proper row closing, QueryRow vs Query semantics, and strategies to avoid N+1 queries.
- Transactions and helpers: Transaction wrapper patterns that guarantee rollback on errors and guidance on isolation levels for critical operations.
- Tooling and workflows: Recommendations for sqlc for type-safe SQL, migration tooling best practices, and repository interface design for testability.
- Use Case: Implement a Postgres-backed service that requires safe concurrent access, atomic money transfers, and reliable schema migrations.
Quick Start
Use the go-database skill to audit your repository and produce idiomatic connection pool configuration, transaction helpers, and sqlc-ready queries for a Postgres service.