Skip to content

Commit b306d58

Browse files
authored
Merge pull request #1574 from ydb-platform/options-execute
publish options.Execute
2 parents cb0dbd7 + 9ce20de commit b306d58

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* Published `query.ExecuteOption` as alias to `internal/query/options.Execute`
2+
13
## v3.93.0
24
* Added `ydb.WithStaticCredentialsLogin` and `ydb.WithStaticCredentialsPassword` options
35

@@ -6,7 +8,7 @@
68
* Added `database/sql/driver.Value` as type destination for almost ydb values
79

810
## v3.92.5
9-
* Avoid retrying requests finished with 'UNAUTHORIZED' errors
11+
* Avoid retrying requests finished with `UNAUTHORIZED` errors
1012

1113
## v3.92.4
1214
* Fixed connections pool leak on closing

query/client.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@ type (
1717
//
1818
// Exec used by default:
1919
// - DefaultTxControl
20-
Exec(ctx context.Context, query string, opts ...options.Execute) error
20+
Exec(ctx context.Context, query string, opts ...ExecuteOption) error
2121

2222
// Query execute query with result
2323
//
2424
// Exec used by default:
2525
// - DefaultTxControl
26-
Query(ctx context.Context, query string, opts ...options.Execute) (Result, error)
26+
Query(ctx context.Context, query string, opts ...ExecuteOption) (Result, error)
2727

2828
// QueryResultSet execute query and take the exactly single materialized result set from result
2929
//
3030
// Exec used by default:
3131
// - DefaultTxControl
32-
QueryResultSet(ctx context.Context, query string, opts ...options.Execute) (ClosableResultSet, error)
32+
QueryResultSet(ctx context.Context, query string, opts ...ExecuteOption) (ClosableResultSet, error)
3333

3434
// QueryRow execute query and take the exactly single row from exactly single result set from result
3535
//
3636
// Exec used by default:
3737
// - DefaultTxControl
38-
QueryRow(ctx context.Context, query string, opts ...options.Execute) (Row, error)
38+
QueryRow(ctx context.Context, query string, opts ...ExecuteOption) (Row, error)
3939
}
4040
// Client defines API of query client
4141
Client interface {
@@ -68,31 +68,31 @@ type (
6868
//
6969
// Exec used by default:
7070
// - DefaultTxControl
71-
Exec(ctx context.Context, query string, opts ...options.Execute) error
71+
Exec(ctx context.Context, query string, opts ...ExecuteOption) error
7272

7373
// Query execute query with materialized result
7474
//
7575
// Warning: the large result from query will be materialized and can happened to "OOM killed" problem
7676
//
7777
// Exec used by default:
7878
// - DefaultTxControl
79-
Query(ctx context.Context, query string, opts ...options.Execute) (Result, error)
79+
Query(ctx context.Context, query string, opts ...ExecuteOption) (Result, error)
8080

8181
// QueryResultSet is a helper which read all rows from first result set in result
8282
//
8383
// Warning: the large result set from query will be materialized and can happened to "OOM killed" problem
84-
QueryResultSet(ctx context.Context, query string, opts ...options.Execute) (ClosableResultSet, error)
84+
QueryResultSet(ctx context.Context, query string, opts ...ExecuteOption) (ClosableResultSet, error)
8585

8686
// QueryRow is a helper which read only one row from first result set in result
8787
//
8888
// ReadRow returns error if result contains more than one result set or more than one row
89-
QueryRow(ctx context.Context, query string, opts ...options.Execute) (Row, error)
89+
QueryRow(ctx context.Context, query string, opts ...ExecuteOption) (Row, error)
9090

9191
// ExecuteScript starts long executing script with polling results later
9292
//
9393
// Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
9494
ExecuteScript(
95-
ctx context.Context, query string, ttl time.Duration, ops ...options.Execute,
95+
ctx context.Context, query string, ttl time.Duration, ops ...ExecuteOption,
9696
) (*options.ExecuteScriptOperation, error)
9797

9898
// FetchScriptResults fetching the script results

query/execute_options.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"github.com/ydb-platform/ydb-go-sdk/v3/internal/query/tx"
99
)
1010

11+
type ExecuteOption = options.Execute
12+
1113
const (
1214
SyntaxYQL = options.SyntaxYQL
1315
SyntaxPostgreSQL = options.SyntaxPostgreSQL
@@ -27,47 +29,47 @@ const (
2729
StatsModeProfile = options.StatsModeProfile
2830
)
2931

30-
func WithParameters(parameters *params.Parameters) options.Execute {
32+
func WithParameters(parameters *params.Parameters) ExecuteOption {
3133
return options.WithParameters(parameters)
3234
}
3335

34-
func WithTxControl(txControl *tx.Control) options.Execute {
36+
func WithTxControl(txControl *tx.Control) ExecuteOption {
3537
return options.WithTxControl(txControl)
3638
}
3739

3840
func WithTxSettings(txSettings tx.Settings) options.DoTxOption {
3941
return options.WithTxSettings(txSettings)
4042
}
4143

42-
func WithCommit() options.Execute {
44+
func WithCommit() ExecuteOption {
4345
return options.WithCommit()
4446
}
4547

46-
func WithExecMode(mode options.ExecMode) options.Execute {
48+
func WithExecMode(mode options.ExecMode) ExecuteOption {
4749
return options.WithExecMode(mode)
4850
}
4951

50-
func WithSyntax(syntax options.Syntax) options.Execute {
52+
func WithSyntax(syntax options.Syntax) ExecuteOption {
5153
return options.WithSyntax(syntax)
5254
}
5355

54-
func WithStatsMode(mode options.StatsMode, callback func(Stats)) options.Execute {
56+
func WithStatsMode(mode options.StatsMode, callback func(Stats)) ExecuteOption {
5557
return options.WithStatsMode(mode, callback)
5658
}
5759

5860
// WithResponsePartLimitSizeBytes limit size of each part (data portion) in stream for query service resoponse
5961
// it isn't limit total size of answer
60-
func WithResponsePartLimitSizeBytes(size int64) options.Execute {
62+
func WithResponsePartLimitSizeBytes(size int64) ExecuteOption {
6163
return options.WithResponsePartLimitSizeBytes(size)
6264
}
6365

64-
func WithCallOptions(opts ...grpc.CallOption) options.Execute {
66+
func WithCallOptions(opts ...grpc.CallOption) ExecuteOption {
6567
return options.WithCallOptions(opts...)
6668
}
6769

6870
// WithResourcePool is an option for define resource pool for execute query
6971
//
7072
// Read more https://ydb.tech/docs/ru/dev/resource-consumption-management
71-
func WithResourcePool(id string) options.Execute {
73+
func WithResourcePool(id string) ExecuteOption {
7274
return options.WithResourcePool(id)
7375
}

0 commit comments

Comments
 (0)