I have a database per user in my use case (I know it is not the best decision but is a project requirement). I would like to open one connection and change the database name for every query.
I could use db.Exec("use clientdatabase;"); to change the database before execute every query but if at the same time another query arrives or is executing could be problems because all the app are using the same db connection.
May be, I could use a map of connections per client/database with a map number of elements in the max and deleting old connections.
Even I could create a connection for every query, but it could be a waste of time if one client have several queries.