I have 10 databases in one instance. I want to take a single connection pool to the instance. From that connection I will trigger "use database" query before trigger any other query or I can build query with database name. Ex select * from database.table
.
How do I get connection pool to instance without database in xorm or golang?
Just use the DSN without selecting a database:
dsn := "root:@/"
db, err := sql.Open("mysql", dsn)
and then use one of your suggestions. You can also create a 10-keys map between the databases' names and their corresponded Db
object.