forked from influxdata/influxdb-iox-client-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
driver_statement.go
55 lines (44 loc) · 1.22 KB
/
driver_statement.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
package ioxsql
import (
"context"
"database/sql/driver"
"errors"
"github.com/influxdata/influxdb-iox-client-go/v2"
)
var (
_ driver.Stmt = (*statement)(nil)
_ driver.StmtExecContext = (*statement)(nil)
_ driver.StmtQueryContext = (*statement)(nil)
)
type statement struct {
request *influxdbiox.QueryRequest
}
func newStatement(request *influxdbiox.QueryRequest) *statement {
return &statement{
request: request,
}
}
func (s *statement) Close() error {
return nil
}
func (s *statement) NumInput() int {
return -1
}
func (s *statement) Exec(args []driver.Value) (driver.Result, error) {
return nil, errors.New("exec not implemented")
}
func (s *statement) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) {
return nil, errors.New("exec not implemented")
}
func (s *statement) Query(args []driver.Value) (driver.Rows, error) {
if len(args) > 0 {
return nil, errors.New("query args not supported")
}
return queryRows(context.Background(), s.request, nil)
}
func (s *statement) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
if len(args) > 0 {
return nil, errors.New("query args not supported")
}
return queryRows(ctx, s.request, nil)
}