What problem does it solve?
It helps you write Go database code that is safe and correct—avoiding SQL injection, connection leaks, NULL-handling bugs, and subtle transaction/locking issues.
Core Features & Use Cases
- Safe parameterized queries: Ensures SQL placeholders are used instead of string concatenation to prevent injection.
- Correct execution patterns: Guides you to use the right database/sql methods (e.g., ExecContext vs QueryContext) to avoid resource leaks.
- Robust scanning and error handling: Recommends explicit NULL handling (pointer fields), proper rows.Close() usage, rows.Err() checks, and sql.ErrNoRows translation to domain errors.
- Transactions and concurrency control: Covers transaction boundaries, isolation levels, and SELECT ... FOR UPDATE to prevent races.
- Performance-minded practices: Includes connection pool configuration, batching guidance, and cursor-based pagination patterns.
Quick Start
Ask an agent to generate a Go repository function that uses sqlx with context-aware, parameterized queries and correct rows closing and sql.ErrNoRows handling for PostgreSQL.