diff --git a/db/db.go b/db/db.go index 08559eed..3dc2afc3 100644 --- a/db/db.go +++ b/db/db.go @@ -543,13 +543,14 @@ func (db *DB) Query(req *command.Request, xTime bool) ([]*command.QueryRows, err return db.queryWithConn(req, xTime, conn) } +type queryer interface { + QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) +} + func (db *DB) queryWithConn(req *command.Request, xTime bool, conn *sql.Conn) ([]*command.QueryRows, error) { var err error - type Queryer interface { - QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) - } - var queryer Queryer + var queryer queryer var tx *sql.Tx if req.Transaction { stats.Add(numQTx, 1) @@ -621,10 +622,6 @@ func (db *DB) queryWithConn(req *command.Request, xTime bool, conn *sql.Conn) ([ return allRows, err } -type queryer interface { - QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) -} - func (db *DB) queryStmtWithConn(stmt *command.Statement, xTime bool, q queryer) (*command.QueryRows, error) { rows := &command.QueryRows{} start := time.Now()