forked from go-gorm/bigquery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscanner.go
63 lines (47 loc) · 1.17 KB
/
scanner.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
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
package driver
import (
"context"
"database/sql/driver"
"errors"
)
type scannerConnection struct {
}
func (scannerConnection) Prepare(query string) (driver.Stmt, error) {
return &scannerStatement{}, nil
}
func (scannerConnection) Close() error {
return nil
}
func (scannerConnection) Begin() (driver.Tx, error) {
return nil, nil
}
func (scannerConnection) Ping(ctx context.Context) error {
return nil
}
func (scannerConnection) CheckNamedValue(*driver.NamedValue) error {
return nil
}
type scannerStatement struct {
}
func (scannerStatement) CheckNamedValue(*driver.NamedValue) error {
return nil
}
func (s scannerStatement) Close() error {
return nil
}
func (s scannerStatement) NumInput() int {
return 1
}
func (s scannerStatement) Exec(args []driver.Value) (driver.Result, error) {
return nil, errors.New("execution is not supported")
}
func (s scannerStatement) Query(args []driver.Value) (driver.Rows, error) {
if len(args) < 1 {
return nil, errors.New("scanner arguments should have an argument with rows")
}
rows, ok := args[0].(driver.Rows)
if !ok {
return nil, errors.New("scanner arguments should have an argument with rows")
}
return rows, nil
}