fixup
Some checks failed
automerge / automerge (pull_request) Failing after 6s
codeql / analyze (go) (pull_request) Failing after 3m21s
dependabot-automerge / automerge (pull_request) Has been skipped
prbuild / test (pull_request) Failing after 1m28s
prbuild / lint (pull_request) Failing after 2m38s
autoapprove / autoapprove (pull_request) Failing after 1m25s
Some checks failed
automerge / automerge (pull_request) Failing after 6s
codeql / analyze (go) (pull_request) Failing after 3m21s
dependabot-automerge / automerge (pull_request) Has been skipped
prbuild / test (pull_request) Failing after 1m28s
prbuild / lint (pull_request) Failing after 2m38s
autoapprove / autoapprove (pull_request) Failing after 1m25s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
dbce4a1d9e
commit
62f72197ba
3
stmt.go
3
stmt.go
@ -75,8 +75,7 @@ func (w *wrapperStmt) Exec(args []driver.Value) (driver.Result, error) {
|
||||
}
|
||||
labels := []string{labelMethod, "Exec"}
|
||||
ts := time.Now()
|
||||
// nolint:staticcheck
|
||||
res, err := w.stmt.Exec(args)
|
||||
res, err := w.stmt.Exec(args) // nolint:staticcheck
|
||||
td := time.Since(ts)
|
||||
te := td.Seconds()
|
||||
if err != nil {
|
||||
|
112
wrap.go
112
wrap.go
@ -11,118 +11,6 @@ func wrapDriver(d driver.Driver, opts Options) driver.Driver {
|
||||
return struct{ driver.Driver }{&wrapperDriver{driver: d, opts: opts}}
|
||||
}
|
||||
|
||||
/*
|
||||
func wrapStmt(stmt driver.Stmt, query string, opts Options) driver.Stmt {
|
||||
var (
|
||||
_, hasExeCtx = stmt.(driver.StmtExecContext)
|
||||
_, hasQryCtx = stmt.(driver.StmtQueryContext)
|
||||
wc, hasColConv = stmt.(driver.ColumnConverter) //nolint:staticcheck
|
||||
wn, hasNamValChk = stmt.(driver.NamedValueChecker)
|
||||
)
|
||||
|
||||
ws := &wrapperStmt{stmt: stmt, query: query, opts: opts}
|
||||
switch {
|
||||
case !hasExeCtx && !hasQryCtx && !hasColConv && !hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
}{ws}
|
||||
case !hasExeCtx && hasQryCtx && !hasColConv && !hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.StmtQueryContext
|
||||
}{ws, ws}
|
||||
case hasExeCtx && !hasQryCtx && !hasColConv && !hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.StmtExecContext
|
||||
}{ws, ws}
|
||||
case hasExeCtx && hasQryCtx && !hasColConv && !hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.StmtExecContext
|
||||
driver.StmtQueryContext
|
||||
}{ws, ws, ws}
|
||||
case !hasExeCtx && !hasQryCtx && hasColConv && !hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.ColumnConverter
|
||||
}{ws, wc}
|
||||
case !hasExeCtx && hasQryCtx && hasColConv && !hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.StmtQueryContext
|
||||
driver.ColumnConverter
|
||||
}{ws, ws, wc}
|
||||
case hasExeCtx && !hasQryCtx && hasColConv && !hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.StmtExecContext
|
||||
driver.ColumnConverter
|
||||
}{ws, ws, wc}
|
||||
case hasExeCtx && hasQryCtx && hasColConv && !hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.StmtExecContext
|
||||
driver.StmtQueryContext
|
||||
driver.ColumnConverter
|
||||
}{ws, ws, ws, wc}
|
||||
case !hasExeCtx && !hasQryCtx && !hasColConv && hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.NamedValueChecker
|
||||
}{ws, wn}
|
||||
case !hasExeCtx && hasQryCtx && !hasColConv && hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.StmtQueryContext
|
||||
driver.NamedValueChecker
|
||||
}{ws, ws, wn}
|
||||
case hasExeCtx && !hasQryCtx && !hasColConv && hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.StmtExecContext
|
||||
driver.NamedValueChecker
|
||||
}{ws, ws, wn}
|
||||
case hasExeCtx && hasQryCtx && !hasColConv && hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.StmtExecContext
|
||||
driver.StmtQueryContext
|
||||
driver.NamedValueChecker
|
||||
}{ws, ws, ws, wn}
|
||||
case !hasExeCtx && !hasQryCtx && hasColConv && hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.ColumnConverter
|
||||
driver.NamedValueChecker
|
||||
}{ws, wc, wn}
|
||||
case !hasExeCtx && hasQryCtx && hasColConv && hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.StmtQueryContext
|
||||
driver.ColumnConverter
|
||||
driver.NamedValueChecker
|
||||
}{ws, ws, wc, wn}
|
||||
case hasExeCtx && !hasQryCtx && hasColConv && hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.StmtExecContext
|
||||
driver.ColumnConverter
|
||||
driver.NamedValueChecker
|
||||
}{ws, ws, wc, wn}
|
||||
case hasExeCtx && hasQryCtx && hasColConv && hasNamValChk:
|
||||
return struct {
|
||||
driver.Stmt
|
||||
driver.StmtExecContext
|
||||
driver.StmtQueryContext
|
||||
driver.ColumnConverter
|
||||
driver.NamedValueChecker
|
||||
}{ws, ws, ws, wc, wn}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
*/
|
||||
|
||||
// WrapConn allows an existing driver.Conn to be wrapped.
|
||||
func WrapConn(c driver.Conn, opts ...Option) driver.Conn {
|
||||
return wrapConn(c, NewOptions(opts...))
|
||||
|
Loading…
Reference in New Issue
Block a user