Skip to content
New issue

Have a question about this project?Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of serviceand privacy statement.We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get addr(ip adn port) from a gorm.DB value #7097

Open
fys445089968opened this issue Jul 3, 2024 · 0 comments
Open

how to get addr(ip adn port) from a gorm.DB value #7097

fys445089968opened this issue Jul 3, 2024 · 0 comments
Assignees
Labels
type:question general questions

Comments

@fys445089968
Copy link

Your Question

The document you expected this should be explained

Expected answer

I use "db.Callback().Query().After(" gorm:after_query ").Register(" after_query ", errCircult)" to register errCircult to detect db circult status. how can I get addr(ip adn port) from a gorm.DB value.
func errCircult(db *gorm.DB) {
if db.Error!= nil && db.Error!= gorm.ErrRecordNotFound {
ins, _:= MysqlPolarisApi.GetInstance(map[string]string{ "ro": "sz" })
// how to get ip and report it to Circuit Breaker
MysqlPolarisApi.CallResult(ins, model.RetFail, 1002, time.Duration(100))
}
}

@fys445089968 fys445089968 added the type:question general questions label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question general questions
Projects
None yet
Development

No branches or pull requests

2 participants