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
+5.6k Golang : Shortening import identifier
+29.5k Golang : Saving(serializing) and reading file with GOB
+9.2k Golang : Write multiple lines or divide string into multiple lines
+16.5k Golang : Check if a string contains multiple sub-strings in []string?
+5.2k Golang : Convert lines of string into list for delete and insert operation
+12.9k Python : Convert IPv6 address to decimal and back to IPv6
+29.9k Golang : How to get HTTP request header information?
+5.2k Golang : Experimental Jawi programming language
+7.8k Swift : Convert (cast) String to Double
+15.6k Golang : Force download file example
+6.5k Golang : Handling image beyond OpenCV video capture boundary
+6.4k Golang : How to search a list of records or data structures