-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathdbr_go18.go
36 lines (29 loc) · 1.19 KB
/
dbr_go18.go
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
// +build go1.8
package dbr
import (
"database/sql"
)
// Exec executes a query without returning any rows.
// The args are for any placeholder parameters in the query.
func (sess *Session) Exec(query string, args ...interface{}) (sql.Result, error) {
return sess.ExecContext(sess.ctx, query, args...)
}
// Query executes a query that returns rows, typically a SELECT.
// The args are for any placeholder parameters in the query.
func (sess *Session) Query(query string, args ...interface{}) (*sql.Rows, error) {
return sess.QueryContext(sess.ctx, query, args...)
}
// Exec executes a query without returning any rows.
// The args are for any placeholder parameters in the query.
func (tx *Tx) Exec(query string, args ...interface{}) (sql.Result, error) {
return tx.ExecContext(tx.ctx, query, args...)
}
// Query executes a query that returns rows, typically a SELECT.
// The args are for any placeholder parameters in the query.
func (tx *Tx) Query(query string, args ...interface{}) (*sql.Rows, error) {
return tx.QueryContext(tx.ctx, query, args...)
}
// beginTx starts a transaction with context.
func (sess *Session) beginTx(opts *sql.TxOptions) (*sql.Tx, error) {
return sess.BeginTx(sess.ctx, opts)
}