Is it possible to print the DB connection that the resolver is using under the hood.

Reproduction steps:

I'm doing a

INSERT ... ON CONFLICT DO NOTHING;

followed by a

SELECT ...

on the item that I inserted. I am getting a record not found and am guessing it is because of replication lag? However, I added:

tx = tx.Clauses(dbresolver.Write)

but am still getting the error. Therefore, to sanity check, I want to make sure the DB connection that is being hit is indeed the primary and not the replica with some sort of print statement.

The document you expected this should be explained

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

Expected answer

How do I debug this issue?

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: a631807682

We can use Connection to check whether the problem is caused by the master-slave database. Looks like we need to support this feat https://github.com/go-gorm/dbresolver/issues/75

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking