@@ -5,7 +5,6 @@ package squirrel
5
5
6
6
import (
7
7
"bytes"
8
- "context"
9
8
"database/sql"
10
9
"fmt"
11
10
"strings"
@@ -21,30 +20,6 @@ type Sqlizer interface {
21
20
ToSql () (string , []interface {}, error )
22
21
}
23
22
24
- // Execer is the interface that wraps the Exec method.
25
- //
26
- // Exec executes the given query as implemented by database/sql.Exec.
27
- type Execer interface {
28
- Exec (query string , args ... interface {}) (sql.Result , error )
29
- ExecContext (ctx context.Context , query string , args ... interface {}) (sql.Result , error )
30
- }
31
-
32
- // Queryer is the interface that wraps the Query method.
33
- //
34
- // Query executes the given query as implemented by database/sql.Query.
35
- type Queryer interface {
36
- Query (query string , args ... interface {}) (* sql.Rows , error )
37
- QueryContext (ctx context.Context , query string , args ... interface {}) (* sql.Rows , error )
38
- }
39
-
40
- // QueryRower is the interface that wraps the QueryRow method.
41
- //
42
- // QueryRow executes the given query as implemented by database/sql.QueryRow.
43
- type QueryRower interface {
44
- QueryRow (query string , args ... interface {}) RowScanner
45
- QueryRowContext (ctx context.Context , query string , args ... interface {}) RowScanner
46
- }
47
-
48
23
// BaseRunner groups the Execer and Queryer interfaces.
49
24
type BaseRunner interface {
50
25
Execer
@@ -67,10 +42,6 @@ func (r *dbRunner) QueryRow(query string, args ...interface{}) RowScanner {
67
42
return r .DB .QueryRow (query , args ... )
68
43
}
69
44
70
- func (r * dbRunner ) QueryRowContext (ctx context.Context , query string , args ... interface {}) RowScanner {
71
- return r .DB .QueryRowContext (ctx , query , args ... )
72
- }
73
-
74
45
type txRunner struct {
75
46
* sql.Tx
76
47
}
@@ -79,10 +50,6 @@ func (r *txRunner) QueryRow(query string, args ...interface{}) RowScanner {
79
50
return r .Tx .QueryRow (query , args ... )
80
51
}
81
52
82
- func (r * txRunner ) QueryRowContext (ctx context.Context , query string , args ... interface {}) RowScanner {
83
- return r .Tx .QueryRowContext (ctx , query , args ... )
84
- }
85
-
86
53
func setRunWith (b interface {}, baseRunner BaseRunner ) interface {} {
87
54
var runner Runner
88
55
switch r := baseRunner .(type ) {
@@ -126,30 +93,6 @@ func QueryRowWith(db QueryRower, s Sqlizer) RowScanner {
126
93
return & Row {RowScanner : db .QueryRow (query , args ... ), err : err }
127
94
}
128
95
129
- // ExecContextWith ExecContexts the SQL returned by s with db.
130
- func ExecContextWith (ctx context.Context , db Execer , s Sqlizer ) (res sql.Result , err error ) {
131
- query , args , err := s .ToSql ()
132
- if err != nil {
133
- return
134
- }
135
- return db .ExecContext (ctx , query , args ... )
136
- }
137
-
138
- // QueryContextWith QueryContexts the SQL returned by s with db.
139
- func QueryContextWith (ctx context.Context , db Queryer , s Sqlizer ) (rows * sql.Rows , err error ) {
140
- query , args , err := s .ToSql ()
141
- if err != nil {
142
- return
143
- }
144
- return db .QueryContext (ctx , query , args ... )
145
- }
146
-
147
- // QueryRowContextWith QueryRowContexts the SQL returned by s with db.
148
- func QueryRowContextWith (ctx context.Context , db QueryRower , s Sqlizer ) RowScanner {
149
- query , args , err := s .ToSql ()
150
- return & Row {RowScanner : db .QueryRowContext (ctx , query , args ... ), err : err }
151
- }
152
-
153
96
// DebugSqlizer calls ToSql on s and shows the approximate SQL to be executed
154
97
//
155
98
// If ToSql returns an error, the result of this method will look like:
0 commit comments