package tx
import "github.com/ydb-platform/ydb-go-sdk/v3/internal/tx"
Index ¶
- Constants
- func BeginTx(opts ...SettingsOption) beginTxOptions
- func WithOnlineReadOnly(opts ...OnlineReadOnlyOption) onlineReadOnlySettingsOption
- func WithTx(t Identifier) txIDTxControlOption
- func WithTxControl(ctx context.Context, txControl *Control) context.Context
- func WithTxControlHook(ctx context.Context, hook txControlHook) context.Context
- func WithTxID(txID string) txIDTxControlOption
- type Control
- func ControlFromContext(ctx context.Context, defaultTxControl *Control) (txControl *Control)
- func DefaultTxControl() *Control
- func NewControl(opts ...ControlOption) *Control
- func NoTx() *Control
- func OnlineReadOnlyTxControl(opts ...OnlineReadOnlyOption) *Control
- func SerializableReadWriteTxControl(opts ...ControlOption) *Control
- func SnapshotReadOnlyTxControl() *Control
- func StaleReadOnlyTxControl() *Control
- func WithCommit(ctrl *Control) *Control
- func (ctrl *Control) Commit() bool
- func (ctrl *Control) Selector() Selector
- func (ctrl *Control) ToYdbQueryTransactionControl() *Ydb_Query.TransactionControl
- func (ctrl *Control) ToYdbTableTransactionControl() *Ydb_Table.TransactionControl
- type ControlOption
- type Identifier
- type LazyID
- type OnTransactionBeforeCommit
- type OnTransactionCompletedFunc
- type OnlineReadOnlyOption
- type Selector
- type Settings
- func NewSettings(opts ...SettingsOption) Settings
- func (opts Settings) ToYdbQuerySettings() *Ydb_Query.TransactionSettings
- func (opts Settings) ToYdbTableSettings() *Ydb_Table.TransactionSettings
- type SettingsOption
- func WithDefaultTxMode() SettingsOption
- func WithSerializableReadWrite() SettingsOption
- func WithSnapshotReadOnly() SettingsOption
- func WithStaleReadOnly() SettingsOption
- type Transaction
Constants ¶
const ( LazyTxID = "LAZY_TX" FakeTxID = "FAKE_TX" )
Functions ¶
func BeginTx ¶
func BeginTx(opts ...SettingsOption) beginTxOptions
BeginTx returns selector transaction control option
func WithOnlineReadOnly ¶
func WithOnlineReadOnly(opts ...OnlineReadOnlyOption) onlineReadOnlySettingsOption
func WithTx ¶
func WithTx(t Identifier) txIDTxControlOption
func WithTxControl ¶
func WithTxControlHook ¶
func WithTxID ¶
func WithTxID(txID string) txIDTxControlOption
Types ¶
type Control ¶
type Control struct {
// contains filtered or unexported fields
}
func ControlFromContext ¶
func DefaultTxControl ¶
func DefaultTxControl() *Control
DefaultTxControl returns default transaction control with serializable read-write isolation mode and auto-commit
func NewControl ¶
func NewControl(opts ...ControlOption) *Control
NewControl makes transaction control from given options
func NoTx ¶
func NoTx() *Control
func OnlineReadOnlyTxControl ¶
func OnlineReadOnlyTxControl(opts ...OnlineReadOnlyOption) *Control
OnlineReadOnlyTxControl returns online read-only transaction control
func SerializableReadWriteTxControl ¶
func SerializableReadWriteTxControl(opts ...ControlOption) *Control
SerializableReadWriteTxControl returns transaction control with serializable read-write isolation mode
func SnapshotReadOnlyTxControl ¶
func SnapshotReadOnlyTxControl() *Control
SnapshotReadOnlyTxControl returns snapshot read-only transaction control
func StaleReadOnlyTxControl ¶
func StaleReadOnlyTxControl() *Control
StaleReadOnlyTxControl returns stale read-only transaction control
func WithCommit ¶
func (*Control) Commit ¶
func (*Control) Selector ¶
func (*Control) ToYdbQueryTransactionControl ¶
func (ctrl *Control) ToYdbQueryTransactionControl() *Ydb_Query.TransactionControl
func (*Control) ToYdbTableTransactionControl ¶
func (ctrl *Control) ToYdbTableTransactionControl() *Ydb_Table.TransactionControl
type ControlOption ¶
type ControlOption interface {
// contains filtered or unexported methods
}
func CommitTx ¶
func CommitTx() ControlOption
CommitTx returns commit transaction control option
type Identifier ¶
type Identifier interface { ID() string // contains filtered or unexported methods }
type LazyID ¶
type LazyID struct {
// contains filtered or unexported fields
}
func ID ¶
func (LazyID) ID ¶
func (*LazyID) SetTxID ¶
type OnTransactionBeforeCommit ¶
type OnTransactionCompletedFunc ¶
type OnTransactionCompletedFunc func(transactionResult error)
type OnlineReadOnlyOption ¶
type OnlineReadOnlyOption interface {
// contains filtered or unexported methods
}
func WithInconsistentReads ¶
func WithInconsistentReads() OnlineReadOnlyOption
type Selector ¶
type Selector interface {
// contains filtered or unexported methods
}
type Settings ¶
type Settings []SettingsOption
Transaction settings options
func NewSettings ¶
func NewSettings(opts ...SettingsOption) Settings
NewSettings returns transaction settings
func (Settings) ToYdbQuerySettings ¶
func (opts Settings) ToYdbQuerySettings() *Ydb_Query.TransactionSettings
func (Settings) ToYdbTableSettings ¶
func (opts Settings) ToYdbTableSettings() *Ydb_Table.TransactionSettings
type SettingsOption ¶
type SettingsOption interface { ApplyQueryTxSettingsOption(txSettings *Ydb_Query.TransactionSettings) ApplyTableTxSettingsOption(txSettings *Ydb_Table.TransactionSettings) }
Transaction settings options
func WithDefaultTxMode ¶
func WithDefaultTxMode() SettingsOption
func WithSerializableReadWrite ¶
func WithSerializableReadWrite() SettingsOption
func WithSnapshotReadOnly ¶
func WithSnapshotReadOnly() SettingsOption
func WithStaleReadOnly ¶
func WithStaleReadOnly() SettingsOption
type Transaction ¶
type Transaction interface { Identifier UnLazy(ctx context.Context) error SessionID() string // OnBeforeCommit add callback, which will be called before commit transaction // the method will be not call the method if some error happen and transaction will not be committed OnBeforeCommit(f OnTransactionBeforeCommit) OnCompleted(f OnTransactionCompletedFunc) Rollback(ctx context.Context) error }
func AsTransaction ¶
func AsTransaction(id Identifier) (Transaction, error)
Source Files ¶
context.go control.go id.go settings.go transaction.go
- Version
- v3.107.0
- Published
- Apr 16, 2025
- Platform
- js/wasm
- Imports
- 5 packages
- Last checked
- 5 minutes ago –
Tools for package owners.