What problem does it solve?
Go applications often struggle with safe, observable database access. This skill provides a pragmatic approach to raw SQL in Go using sqlx or pgx, enforcing parameterized queries, explicit context propagation, robust error handling, and clear transaction boundaries. It also helps avoid ORM pitfalls and promotes testable, maintainable database code.
Core Features & Use Cases
- Enforces parameterized SQL across all queries to prevent injection.
- Encourages explicit context usage (QueryContext, ExecContext, GetContext) for deadlines and cancellations.
- Demonstrates proper transaction patterns, row scanning, and NULL handling without ORM abstractions.
- Use Case: when building a Go backend that talks to PostgreSQL, MariaDB, MySQL, or SQLite and needs observable, auditable data access code.
Quick Start
Install sqlx or pgx, wire a DB instance, and start writing context-aware, parameterized queries against your database.