-
Notifications
You must be signed in to change notification settings - Fork 6
/
row.go
29 lines (26 loc) · 727 Bytes
/
row.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
package sql
import (
"context"
stdSql "database/sql"
"time"
)
// Row is the result of calling QueryRow to select a single row.
type Row struct {
ctx context.Context
row *stdSql.Row
killerPool StdSQLDB
connectionID string
kto time.Duration
}
// Scan copies the columns from the matched row into the values
// pointed at by dest. See the documentation on Rows.Scan for details.
// If more than one row matches the query,
// Scan uses the first row and discards the rest. If no row matches
// the query, Scan returns ErrNoRows.
func (r *Row) Scan(dest ...interface{}) error {
err := r.row.Scan(dest...)
if r.ctx.Err() != nil {
kill(r.killerPool, r.connectionID, r.kto)
}
return err
}