Vasiliy Tolstov
7d2787c3a6
Some checks failed
automerge / automerge (pull_request) Failing after 4s
codeql / analyze (go) (pull_request) Failing after 3m20s
dependabot-automerge / automerge (pull_request) Has been skipped
prbuild / test (pull_request) Failing after 1m28s
prbuild / lint (pull_request) Failing after 2m34s
autoapprove / autoapprove (pull_request) Failing after 1m25s
18 lines
443 B
Go
18 lines
443 B
Go
package wrapper
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
)
|
|
|
|
func wrapDriver(d driver.Driver, opts Options) driver.Driver {
|
|
if _, ok := d.(driver.DriverContext); ok {
|
|
return &wrapperDriver{driver: d, opts: opts}
|
|
}
|
|
return struct{ driver.Driver }{&wrapperDriver{driver: d, opts: opts}}
|
|
}
|
|
|
|
// WrapConn allows an existing driver.Conn to be wrapped.
|
|
func WrapConn(c driver.Conn, opts ...Option) driver.Conn {
|
|
return wrapConn(c, NewOptions(opts...))
|
|
}
|