Skip to content

Commit 3e16b3a

Browse files
authored
Merge pull request #1266 from ydb-platform/make-some-options-public
Added public types for `tx.Option` and `options.DoOption`
2 parents 4ed0f00 + 1a99a7b commit 3e16b3a

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* Added public types for `tx.Option`, `options.DoOption` and `options.DoTxOption`
2+
13
## v3.73.1
24
* Changed `query.DefaultTxControl()` from `query.SerializableReadWrite()` with commit to `query.NoTx()`
35

query/client.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type Client interface {
1717
// - retry operation returned nil as error
1818
//
1919
// Warning: if context without deadline or cancellation func than Do can run indefinitely.
20-
Do(ctx context.Context, op Operation, opts ...options.DoOption) error
20+
Do(ctx context.Context, op Operation, opts ...DoOption) error
2121

2222
// DoTx provide the best effort for execute transaction.
2323
//
@@ -31,7 +31,7 @@ type Client interface {
3131
// If op TxOperation returns nil - transaction will be committed
3232
// If op TxOperation return non nil - transaction will be rollback
3333
// Warning: if context without deadline or cancellation func than DoTx can run indefinitely
34-
DoTx(ctx context.Context, op TxOperation, opts ...options.DoTxOption) error
34+
DoTx(ctx context.Context, op TxOperation, opts ...DoTxOption) error
3535

3636
// Execute is a simple executor with retries
3737
//
@@ -73,6 +73,8 @@ type (
7373

7474
Session
7575
}
76+
DoOption = options.DoOption
77+
DoTxOption = options.DoTxOption
7678
)
7779

7880
func WithIdempotent() options.RetryOptionsOption {

query/transaction.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ type (
4343
}
4444
TransactionControl = tx.Control
4545
TransactionSettings = tx.Settings
46+
TransactionOption = tx.Option
4647
)
4748

4849
// BeginTx returns selector transaction control option
49-
func BeginTx(opts ...tx.Option) tx.ControlOption {
50+
func BeginTx(opts ...TransactionOption) tx.ControlOption {
5051
return tx.BeginTx(opts...)
5152
}
5253

@@ -111,26 +112,26 @@ func TxSettings(opts ...tx.Option) TransactionSettings {
111112
return opts
112113
}
113114

114-
func WithDefaultTxMode() tx.Option {
115+
func WithDefaultTxMode() TransactionOption {
115116
return tx.WithDefaultTxMode()
116117
}
117118

118-
func WithSerializableReadWrite() tx.Option {
119+
func WithSerializableReadWrite() TransactionOption {
119120
return tx.WithSerializableReadWrite()
120121
}
121122

122-
func WithSnapshotReadOnly() tx.Option {
123+
func WithSnapshotReadOnly() TransactionOption {
123124
return tx.WithSnapshotReadOnly()
124125
}
125126

126-
func WithStaleReadOnly() tx.Option {
127+
func WithStaleReadOnly() TransactionOption {
127128
return tx.WithStaleReadOnly()
128129
}
129130

130131
func WithInconsistentReads() tx.OnlineReadOnlyOption {
131132
return tx.WithInconsistentReads()
132133
}
133134

134-
func WithOnlineReadOnly(opts ...tx.OnlineReadOnlyOption) tx.Option {
135+
func WithOnlineReadOnly(opts ...tx.OnlineReadOnlyOption) TransactionOption {
135136
return tx.WithOnlineReadOnly(opts...)
136137
}

0 commit comments

Comments
 (0)