Skip to content

Commit 6c1eb76

Browse files
committed
fix WithLazyTx
1 parent 6dc693a commit 6c1eb76

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
* Added `ydb.WithLazyTx()` option for create lazy transactions on `query.Session.Begin` call
1+
* Added `ydb.WithLazyTx(bool)` option for create lazy transactions on `query.Session.Begin` call
22
* Added initial experimental topic and cdc-helpers, see examples in [tests/integration/topic_helpers_test.go](https://github.com/ydb-platform/ydb-go-sdk/blob/master/tests/integration/topic_helpers_test.go)
33
* Added experimental `sugar.UnmarshalRows` for user unmarshaller structs in own code in go 1.23, change example for use the iterator.
44
* Added `ydb_go_sdk_ydb_query_pool_size_index` metrics

internal/query/config/options.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ func WithSessionIdleTimeToLive(idleTimeToLive time.Duration) Option {
6666
}
6767
}
6868

69-
func WithLazyTx() Option {
69+
func WithLazyTx(lazyTx bool) Option {
7070
return func(c *Config) {
71-
c.lazyTx = true
71+
c.lazyTx = lazyTx
7272
}
7373
}

options.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,9 @@ func WithSessionPoolSizeLimit(sizeLimit int) Option {
488488
}
489489
}
490490

491-
func WithLazyTx() Option {
491+
func WithLazyTx(lazyTx bool) Option {
492492
return func(ctx context.Context, d *Driver) error {
493-
d.queryOptions = append(d.queryOptions, queryConfig.WithLazyTx())
493+
d.queryOptions = append(d.queryOptions, queryConfig.WithLazyTx(lazyTx))
494494

495495
return nil
496496
}

query/example_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ func Example_retryWithTx() {
415415
func Example_retryWithLazyTx() {
416416
ctx := context.TODO()
417417
db, err := ydb.Open(ctx, "grpc://localhost:2136/local",
418-
ydb.WithLazyTx(),
418+
ydb.WithLazyTx(true),
419419
)
420420
if err != nil {
421421
fmt.Printf("failed connect: %v", err)

tests/integration/query_tx_execute_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func TestQueryTxExecute(t *testing.T) {
7171
columnNames []string
7272
columnTypes []string
7373
)
74-
err := scope.Driver(ydb.WithLazyTx()).Query().DoTx(scope.Ctx, func(ctx context.Context, tx query.TxActor) (err error) {
74+
err := scope.Driver(ydb.WithLazyTx(true)).Query().DoTx(scope.Ctx, func(ctx context.Context, tx query.TxActor) (err error) {
7575
if tx.ID() != baseTx.LazyTxID {
7676
return errors.New("transaction is not lazy")
7777
}
@@ -262,7 +262,7 @@ func TestQueryLazyTxExecute(t *testing.T) {
262262
columnTypes []string
263263
)
264264
t.Run("Default", func(t *testing.T) {
265-
err := scope.DriverWithLogs(ydb.WithLazyTx()).Query().DoTx(
265+
err := scope.DriverWithLogs(ydb.WithLazyTx(true)).Query().DoTx(
266266
scope.Ctx, func(ctx context.Context, tx query.TxActor) (err error) {
267267
if tx.ID() != baseTx.LazyTxID {
268268
return errors.New("transaction is not lazy")

0 commit comments

Comments
 (0)