Behind the scenes, DB is actually a connection pool, not a single
connection, which will open new connections when you need them.
In our services - which do a LOT of DB work, we only open a single sql.DB
connection and share it among all our handlers. Whenever a handler does a
db.Whatever, the db
what is the best practice when we are using database\sql package for
sql.Open and db.close(). I have scenario where i have to multiple function
and each function is responsible to hit the database and fetch the data. In
this case do we need write sql.open() and db.close() in each of those
fun