cqrs

package
v0.28.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Command = icqrs.Command
	Query   = icqrs.Query
)

Variables

View Source
var (
	ErrHandlerNotFound    = icqrs.ErrHandlerNotFound
	ErrResultTypeMismatch = icqrs.ErrResultTypeMismatch
)

Functions

func Register

func Register[TAction icqrs.Action, TResult any](bus Bus, handler Handler[TAction, TResult])

Register registers a type-safe handler for command type C. Panics if a handler is already registered for the same command type.

func Send

func Send[TAction icqrs.Action, TResult any](ctx context.Context, bus Bus, action TAction) (TResult, error)

Send dispatches a command through the behavior pipeline to its registered handler.

Types

type Action

type Action = icqrs.Action

type ActionKind

type ActionKind = icqrs.ActionKind

type BaseCommand

type BaseCommand = icqrs.BaseCommand

type BaseQuery

type BaseQuery = icqrs.BaseQuery

type Behavior

type Behavior = icqrs.Behavior

type BehaviorFunc

type BehaviorFunc = icqrs.BehaviorFunc

type Bus

type Bus = icqrs.Bus

func NewBus added in v0.28.0

func NewBus(behaviors []Behavior) Bus

NewBus creates a Bus with the given behavior middlewares. Behaviors implementing Ordered are wrapped outside-in by ascending Order. Hosts normally obtain the Bus via dependency injection; this constructor exists for standalone use and tests.

type Handler

type Handler[TAction icqrs.Action, TResult any] = icqrs.Handler[TAction, TResult]

type HandlerFunc

type HandlerFunc[TAction icqrs.Action, TResult any] = icqrs.HandlerFunc[TAction, TResult]

type Ordered added in v0.28.0

type Ordered = icqrs.Ordered

type Unit

type Unit = icqrs.Unit

Jump to

Keyboard shortcuts

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