@@ -9,15 +9,20 @@ import (
9
9
"time"
10
10
)
11
11
12
+ // StdSQLLegacy will potentially be removed in Go 2.
13
+ type StdSQLLegacy interface {
14
+ Exec (query string , args ... interface {}) (stdSql.Result , error )
15
+ Prepare (query string ) (* stdSql.Stmt , error )
16
+ Query (query string , args ... interface {}) (* stdSql.Rows , error )
17
+ QueryRow (query string , args ... interface {}) * stdSql.Row
18
+ }
19
+
12
20
// StdSQLCommon is the interface that allows query and exec interactions with a database.
13
21
type StdSQLCommon interface {
14
- Exec ( query string , args ... interface {}) (stdSql. Result , error )
22
+ StdSQLLegacy
15
23
ExecContext (ctx context.Context , query string , args ... interface {}) (stdSql.Result , error )
16
- Prepare (query string ) (* stdSql.Stmt , error )
17
24
PrepareContext (ctx context.Context , query string ) (* stdSql.Stmt , error )
18
- Query (query string , args ... interface {}) (* stdSql.Rows , error )
19
25
QueryContext (ctx context.Context , query string , args ... interface {}) (* stdSql.Rows , error )
20
- QueryRow (query string , args ... interface {}) * stdSql.Row
21
26
QueryRowContext (ctx context.Context , query string , args ... interface {}) * stdSql.Row
22
27
}
23
28
@@ -30,7 +35,11 @@ type StdSQLDB interface {
30
35
Begin () (* stdSql.Tx , error )
31
36
BeginTx (ctx context.Context , opts * stdSql.TxOptions ) (* stdSql.Tx , error )
32
37
Close () error
38
+ }
33
39
40
+ // StdSQLDBExtra is the interface that directly maps to a *stdSql.DB.
41
+ type StdSQLDBExtra interface {
42
+ StdSQLDB
34
43
Driver () driver.Driver
35
44
SetConnMaxLifetime (d time.Duration )
36
45
SetMaxIdleConns (n int )
0 commit comments