There are a couple of good resources you can use here, the first is just about the best reference for using Go with a RDBMS: http://go-database-sql.org/ The second speaks of database connections: http://jmoiron.net/blog/gos-database-sql/ The general approach: 1. Use a single DB connection, it will pool automatically 2. Use this pattern for all single row queries: err = db.QueryRow(`...`, ...).Scan(&...) if err == sql…
I'm actually fighting with some interesting things now with error handling, I wan't aware I had to do my own retry on deadlocks.
Ugh, it's just one of those days I feel like I'm not as good at this as I thought I was.