Although the database/sql package provides support for connection pooling, rate limiting, and timeouts, it's often important to tweak the defaults to better accommodate your database configuration. This can become important when you have horizontal scaling on microservices and don't want to hold too many active connections to the database.
Connection pooling, rate limiting, and timeouts for SQL
Getting ready
Configure your environment according to these steps:
- Refer to the steps given in the Getting ready section of the The database/sql package with MySQL recipe.
- Run the go get https://github.com/agtorre/go-cookbook/tree/master/chapter5/database command or write your own using the The database/sql package with MySQL...