uow

package
v0.0.0-...-3bb572b Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository func(tx *sql.Tx) interface{}

type UnitOfWork

type UnitOfWork struct {
	Tx *sql.Tx
	Db *sql.DB
	// contains filtered or unexported fields
}

func NewUnitOfWork

func NewUnitOfWork(ctx context.Context, db *sql.DB) *UnitOfWork

func (*UnitOfWork) Add

func (u *UnitOfWork) Add(name string, repository Repository)

func (*UnitOfWork) CommitOrRollback

func (u *UnitOfWork) CommitOrRollback() error

func (*UnitOfWork) Do

func (u *UnitOfWork) Do(ctx context.Context, fn func(unitOfWork *UnitOfWork) error) error

func (*UnitOfWork) GetRepository

func (u *UnitOfWork) GetRepository(ctx context.Context, name string) (interface{}, error)

func (*UnitOfWork) Remove

func (u *UnitOfWork) Remove(name string)

func (*UnitOfWork) RollBack

func (u *UnitOfWork) RollBack() error

type UnitOfWorkInterface

type UnitOfWorkInterface interface {
	Add(name string, repository Repository)
	Remove(name string)
	GetRepository(ctx context.Context, name string) (interface{}, error)
	Do(ctx context.Context, fn func(unitOfWork *UnitOfWork) error) error
	CommitOrRollback() error
	RollBack() error
}

Jump to

Keyboard shortcuts

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