db

package
v0.0.0-...-edc78fc Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OrClient

func OrClient(ctx context.Context, client *ent.Client) *ent.Client

return existing tx, new tx or client if tx is not setup

Types

type ContextKey

type ContextKey string
const ContextKeyTx ContextKey = "transaction"

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

type TxContext

type TxContext struct {
	// contains filtered or unexported fields
}

func NewTxContext

func NewTxContext(ctx context.Context) *TxContext

repo is expected to set tx

func (*TxContext) Commit

func (t *TxContext) Commit() error

func (*TxContext) ErrRollback

func (t *TxContext) ErrRollback(error error) error

ErrRollback rolls back tx, cancels context and returns error

func (*TxContext) GetContext

func (t *TxContext) GetContext() context.Context

Jump to

Keyboard shortcuts

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