tx

package
v0.0.0-...-0b358fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func(sessCtx mongo.SessionContext) (interface{}, error)

Callback describes callback accepted by session.WithTransaction

type Executor

type Executor interface {
	WithTransaction(callback Callback) error
}

Executor database transaction executor

type MongoExecutor

type MongoExecutor struct {
	Client *mongo.Client
}

MongoExecutor manages mongo transaction

func NewMongoExecutor

func NewMongoExecutor(client *mongo.Client) *MongoExecutor

NewMongoExecutor creates new MongoExecutor for transaction management

func (*MongoExecutor) WithTransaction

func (e *MongoExecutor) WithTransaction(callback Callback) error

WithTransaction execute callback within transaction

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL