-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathexecute_options.go
75 lines (59 loc) · 2.01 KB
/
execute_options.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
64
65
66
67
68
69
70
71
72
73
74
75
package query
import (
"google.golang.org/grpc"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/params"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/query/options"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/tx"
)
type ExecuteOption = options.Execute
const (
SyntaxYQL = options.SyntaxYQL
SyntaxPostgreSQL = options.SyntaxPostgreSQL
)
const (
ExecModeParse = options.ExecModeParse
ExecModeValidate = options.ExecModeValidate
ExecModeExplain = options.ExecModeExplain
ExecModeExecute = options.ExecModeExecute
)
const (
StatsModeBasic = options.StatsModeBasic
StatsModeNone = options.StatsModeNone
StatsModeFull = options.StatsModeFull
StatsModeProfile = options.StatsModeProfile
)
func WithParameters(parameters params.Parameters) ExecuteOption {
return options.WithParameters(parameters)
}
func WithTxControl(txControl *tx.Control) ExecuteOption {
return options.WithTxControl(txControl)
}
func WithTxSettings(txSettings tx.Settings) options.DoTxOption {
return options.WithTxSettings(txSettings)
}
func WithCommit() ExecuteOption {
return options.WithCommit()
}
func WithExecMode(mode options.ExecMode) ExecuteOption {
return options.WithExecMode(mode)
}
func WithSyntax(syntax options.Syntax) ExecuteOption {
return options.WithSyntax(syntax)
}
func WithStatsMode(mode options.StatsMode, callback func(Stats)) ExecuteOption {
return options.WithStatsMode(mode, callback)
}
// WithResponsePartLimitSizeBytes limit size of each part (data portion) in stream for query service resoponse
// it isn't limit total size of answer
func WithResponsePartLimitSizeBytes(size int64) ExecuteOption {
return options.WithResponsePartLimitSizeBytes(size)
}
func WithCallOptions(opts ...grpc.CallOption) ExecuteOption {
return options.WithCallOptions(opts...)
}
// WithResourcePool is an option for define resource pool for execute query
//
// Read more https://ydb.tech/docs/ru/dev/resource-consumption-management
func WithResourcePool(id string) ExecuteOption {
return options.WithResourcePool(id)
}