Loading…
0+ curated questions with the same answer shape every time: quick recap, deep dive, pitfalls, and follow-ups. Coverage includes .
The database/sql package is Go's built-in database abstraction layer, and sqlx extends it without abstracting it away. This module covers the connection pool (sql.Open returns a pool, not a connection; SetMaxOpenConns, SetMaxIdleConns, SetConnMaxLifetime — the settings that prevent connection exhaustion under load), the query API (db.Query for multiple rows, db.QueryRow for one, db.Exec for mutations), correct rows.Scan and rows.Close patterns (forgetting defer rows.Close() leaks connections), prepared statements (Stmt, the production trade-off vs query overhead), transactions with db.Begin / tx.Rollback / tx.Commit and the defer-Rollback pattern, and sqlx's extensions: named queries (:fieldname placeholders), StructScan and Select for mapping rows directly to structs. The interview question is always 'why use sqlx over an ORM?' — this module gives the production-grounded answer.
Full catalog
Topics are ordered for learning. Within each topic, rows are numbered 1–0 globally so you always know where you are. Collapse topics if you want a lighter view — use Expand all when you need the full list again.
Numbers 1–0 follow the order we recommend — click any row to open the full answer, or use the sticky Next link at the bottom of each page to go Q1 → Q0.