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
+5k Golang : Reclaim memory occupied by make() example
+25.8k Golang : Calculate future date with time.Add() function
+9.1k Golang : ffmpeg with os/exec.Command() returns non-zero status
+4.4k Javascript : How to get width and height of a div?
+3.9k Golang : Converting individual Jawi alphabet to Rumi(Romanized) alphabet example
+34.6k Golang : Strip slashes from string example
+18.4k Golang : How to make function callback or pass value from function as parameter?
+12k Golang : Arithmetic operation with numerical slices or arrays example
+50.7k Golang : Check if item is in slice/array
+6.4k Swift : substringWithRange() function example
+6.2k Golang : Find the longest line of text example