From 62f72197ba6582b2ac017837edcb087911f7ca51 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Tue, 29 Aug 2023 01:25:45 +0300 Subject: [PATCH] fixup Signed-off-by: Vasiliy Tolstov --- stmt.go | 3 +- wrap.go | 112 -------------------------------------------------------- 2 files changed, 1 insertion(+), 114 deletions(-) diff --git a/stmt.go b/stmt.go index 20bc508..8861822 100644 --- a/stmt.go +++ b/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 { diff --git a/wrap.go b/wrap.go index ec4ec4f..527b135 100644 --- a/wrap.go +++ b/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...))