Skip to content

Commit 327ee24

Browse files
committed
Leave options as they were
1 parent edfaf7f commit 327ee24

File tree

3 files changed

+22
-33
lines changed

3 files changed

+22
-33
lines changed

internal/table/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func (c *Client) BulkUpsert(
307307
finalErr = retry.Retry(ctx,
308308
func(ctx context.Context) (err error) {
309309
attempts++
310-
_, err = c.client.BulkUpsert(ctx, &request, config.CallOptions...)
310+
_, err = c.client.BulkUpsert(ctx, &request)
311311

312312
return err
313313
},

table/options/options.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import (
88
"github.com/ydb-platform/ydb-go-sdk/v3/internal/allocator"
99
"github.com/ydb-platform/ydb-go-sdk/v3/internal/types"
1010
"github.com/ydb-platform/ydb-go-sdk/v3/internal/value"
11-
"github.com/ydb-platform/ydb-go-sdk/v3/retry"
12-
"github.com/ydb-platform/ydb-go-sdk/v3/trace"
1311
)
1412

1513
func WithShardKeyBounds() DescribeTableOption {
@@ -871,28 +869,6 @@ func WithKeepInCache(keepInCache bool) ExecuteDataQueryOption {
871869
)
872870
}
873871

874-
type TableOptions struct {
875-
Label string
876-
Idempotent bool
877-
TxSettings *TransactionSettings
878-
TxCommitOptions []CommitTransactionOption
879-
RetryOptions []retry.Option
880-
Trace *trace.Table
881-
CallOptions []grpc.CallOption
882-
}
883-
884-
type TransactionSettings struct {
885-
settings Ydb_Table.TransactionSettings
886-
}
887-
888-
func (t *TransactionSettings) Settings() *Ydb_Table.TransactionSettings {
889-
if t == nil {
890-
return nil
891-
}
892-
893-
return &t.settings
894-
}
895-
896872
type withCallOptions []grpc.CallOption
897873

898874
func (opts withCallOptions) ApplyExecuteScanQueryOption(d *ExecuteScanQueryDesc) []grpc.CallOption {
@@ -909,10 +885,6 @@ func (opts withCallOptions) ApplyExecuteDataQueryOption(
909885
return opts
910886
}
911887

912-
func (opts withCallOptions) ApplyTableOption(tableOpts *TableOptions) {
913-
tableOpts.CallOptions = append(tableOpts.CallOptions, opts...)
914-
}
915-
916888
// WithCallOptions appends flag of commit transaction with executing query
917889
func WithCallOptions(opts ...grpc.CallOption) withCallOptions {
918890
return opts

table/table.go

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,17 @@ type Session interface {
212212
) error
213213
}
214214

215-
type TransactionSettings = options.TransactionSettings
215+
type TransactionSettings struct {
216+
settings Ydb_Table.TransactionSettings
217+
}
218+
219+
func (t *TransactionSettings) Settings() *Ydb_Table.TransactionSettings {
220+
if t == nil {
221+
return nil
222+
}
223+
224+
return &t.settings
225+
}
216226

217227
// Explanation is a result of Explain calls.
218228
type Explanation struct {
@@ -305,7 +315,7 @@ func TxSettings(opts ...TxOption) *TransactionSettings {
305315
s := new(TransactionSettings)
306316
for _, opt := range opts {
307317
if opt != nil {
308-
opt((*txDesc)(s.Settings()))
318+
opt((*txDesc)(&s.settings))
309319
}
310320
}
311321

@@ -317,7 +327,7 @@ func BeginTx(opts ...TxOption) TxControlOption {
317327
return func(d *txControlDesc) {
318328
s := TxSettings(opts...)
319329
d.TxSelector = &Ydb_Table.TransactionControl_BeginTx{
320-
BeginTx: s.Settings(),
330+
BeginTx: &s.settings,
321331
}
322332
}
323333
}
@@ -488,7 +498,14 @@ func ValueParam(name string, v value.Value) ParameterOption {
488498
return params.Named(name, v)
489499
}
490500

491-
type Options = options.TableOptions
501+
type Options struct {
502+
Label string
503+
Idempotent bool
504+
TxSettings *TransactionSettings
505+
TxCommitOptions []options.CommitTransactionOption
506+
RetryOptions []retry.Option
507+
Trace *trace.Table
508+
}
492509

493510
type Option interface {
494511
ApplyTableOption(opts *Options)

0 commit comments

Comments
 (0)