transaction

package
v0.28.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Update

func Update(db *dbbadger.DB, f func(*Tx) error) error

Update creates a badger transaction, passing it to a chain of functions, if all succeed. Useful to use callback to update cache in order to ensure data in badgerDB and cache are consistent.

func WithTx added in v0.17.1

func WithTx(f func(*dbbadger.Txn) error) func(*Tx) error

WithTx is useful when transaction is used without adding callback.

Types

type Tx

type Tx struct {
	DBTxn *dbbadger.Txn
	// contains filtered or unexported fields
}

func (*Tx) OnSucceed

func (b *Tx) OnSucceed(callback func())

OnSucceed adds a callback to execute after the batch has been successfully flushed. useful for implementing the cache where we will only cache after the batch has been successfully flushed

Jump to

Keyboard shortcuts

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