Can gorm register functions that are executed before the query?

problem description

can gorm register functions executed before the query?
I want to record the time spent on the query. It is known that gorm has the function AfterFind, executed after the end of the query to get the time at the end of the query. How can I get the time at the beginning of the query?

Mar.28,2021

  • although I haven't written this kind of code, it can be supported by looking at the documentation, via plugin .
  • something like this: db.Callback (). Query (). Before ("gorm:query"). Register ("my_plugin:before_query", beforeQuery)
Menu