behavior

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"vef:approval:behavior",

	fx.Provide(
		fx.Annotate(
			NewTransactionBehavior,
			fx.ResultTags(`group:"vef:cqrs:behaviors"`),
		),
	),
)

Module provides all CQRS behavior middlewares for the approval module.

Functions

func NewTransactionBehavior

func NewTransactionBehavior(db orm.DB) cqrs.Behavior

NewTransactionBehavior creates a new TransactionBehavior.

Types

type TransactionBehavior

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

TransactionBehavior wraps command handlers in a database transaction. Query handlers bypass the transaction.

func (*TransactionBehavior) Handle

func (b *TransactionBehavior) Handle(ctx context.Context, action cqrs.Action, next func(context.Context) (any, error)) (any, error)

Handle wraps command actions in a database transaction. Query actions pass through unchanged.

Jump to

Keyboard shortcuts

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