Golang database/sql/driver.Execer type example
package database/sql/driver
Execer is an optional interface that may be implemented by a Conn.
If a Conn does not implement Execer, the sql package's DB.Exec will first prepare a query, execute the statement, and then close the statement.
Exec may return ErrSkip.
Golang database/sql/driver.Execer type usage example
// creates a new wrap and registers it with the name "debug"
wrap := dbwrap.New("debug", pqdrv(0))
...
// is used instead of conn.Exec
wrap.HandleExec = func(exec driver.Execer, query string, args []driver.Value) (driver.Result, error) {
fmt.Println("exec: ", query)
// do the real Exec and return the result
return exec.Exec(query, args)
}
References :
https://github.com/metakeule/dbwrap/blob/master/example/simple.go
Advertisement
Something interesting
Tutorials
+8.6k Python : Fix SyntaxError: Non-ASCII character in file, but no encoding declared
+29.2k Golang : missing Git command
+7.5k Golang : Dealing with struct's private part
+7.7k Golang : Test if an input is an Armstrong number example
+7.5k Golang : Gorrila set route name and get the current route name
+7k Golang : Levenshtein distance example
+6.4k Golang : How to search a list of records or data structures
+22.2k Golang : Securing password with salt
+14.6k Golang : GUI with Qt and OpenCV to capture image from camera
+7.7k Golang : Command line ticker to show work in progress
+15.8k Golang : Get digits from integer before and after given position example
+7.2k CloudFlare : Another way to get visitor's real IP address