gorm_uow

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package gorm_uow provides the GORM implementation of the UnitOfWork contract, plus the context plumbing repositories use to join an ambient transaction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inject

func Inject(ctx context.Context, orm *gorm.DB) context.Context

func ORM

func ORM(ctx context.Context, fallback *gorm.DB) *gorm.DB

ORM returns the ambient transaction DB injected by Do, falling back to the supplied db when none is present.

Types

type UnitOfWork

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

UnitOfWork is the GORM-backed implementation of a transactional unit of work. It satisfies the consumer-defined UnitOfWork interface each service declares.

func New

func New(orm *gorm.DB) *UnitOfWork

func (*UnitOfWork) Do

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

Jump to

Keyboard shortcuts

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