3

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Is this possible in xorm?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.