Your Question

I'd like to use read/write connection splitting with the DBResolver. When using this plugin as-documented, the db.Use() function attempts to open a connection to each Source and Replica immediately, then adds them to connection pools.

I'm using this in a setting where it isn't known at DB initialization time if the queries will be read, write, or both. Therefore, I'd like to avoid opening a connection until a query is actually run. Is there any way to achieve this, to prevent the DBResolver from opening both connections when it's registered?

The document you expected this should be explained

https://gorm.io/docs/dbresolver.html

Expected answer

A config option that determines whether connections are opened immediately, or lazily when a query actually needs a connection.

Comment From: github-actions[bot]

This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days

Comment From: jinzhu

No, we don't support this, as it's not our goal. However, you might consider writing a wrapper to achieve it.