Creative Commons License

The idiomatic way to use a SQL, or SQL-like, database in Go is through the database/sql package. It provides a lightweight interface to a row-oriented database. This website is a reference for the most common aspects of how to use it.

Why is this needed? The package’s documentation tells you what everything does, but it doesn’t tell you how to use the package. Many of us find ourselves wishing for a quick-reference and a “getting started” orientation that tells stories instead of listing facts. Contributions are welcome; please send pull requests here.

Start: Overview of Go’s database/sql Package