-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinterface.go
More file actions
71 lines (66 loc) · 2.61 KB
/
interface.go
File metadata and controls
71 lines (66 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package sql
import (
"context"
"database/sql"
"database/sql/driver"
"time"
)
type DB interface {
PingContext(ctx context.Context) error
Ping() error
Close() error
SetMaxIdleConns(n int)
SetMaxOpenConns(n int)
SetConnMaxLifetime(d time.Duration)
SetConnMaxIdleTime(d time.Duration)
Stats() sql.DBStats
PrepareContext(ctx context.Context, query string) (Stmt, error)
Prepare(query string) (Stmt, error)
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
Exec(query string, args ...interface{}) (sql.Result, error)
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
Query(query string, args ...interface{}) (*sql.Rows, error)
QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
QueryRow(query string, args ...interface{}) *sql.Row
BeginTx(ctx context.Context, opts *sql.TxOptions) (Tx, error)
Begin() (Tx, error)
Driver() driver.Driver
Conn(ctx context.Context) (Conn, error)
OriginDB() *sql.DB
}
type Stmt interface {
ExecContext(ctx context.Context, args ...interface{}) (sql.Result, error)
Exec(args ...interface{}) (sql.Result, error)
QueryContext(ctx context.Context, args ...interface{}) (*sql.Rows, error)
Query(args ...interface{}) (*sql.Rows, error)
QueryRowContext(ctx context.Context, args ...interface{}) *sql.Row
QueryRow(args ...interface{}) *sql.Row
Close() error
OriginStmt() *sql.Stmt
}
type Tx interface {
Commit() error
Rollback() error
PrepareContext(ctx context.Context, query string) (Stmt, error)
Prepare(query string) (Stmt, error)
StmtContext(ctx context.Context, stmt Stmt) Stmt
Stmt(stmt Stmt) Stmt
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
Exec(query string, args ...interface{}) (sql.Result, error)
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
Query(query string, args ...interface{}) (*sql.Rows, error)
QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
QueryRow(query string, args ...interface{}) *sql.Row
OriginTx() *sql.Tx
}
type Conn interface {
PingContext(ctx context.Context) error
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
PrepareContext(ctx context.Context, query string) (Stmt, error)
Raw(f func(driverConn interface{}) error) (err error)
BeginTx(ctx context.Context, opts *sql.TxOptions) (Tx, error)
Close() error
OriginConn() *sql.Conn
}