exec

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package exec implements the command execution pipeline for Asynx.

CommandExecutor[T] applies the three-phase command processing pattern:

  • Load — Fetch current aggregate state from EventStore; nil if not found
  • Validate — Call Command.Validate(state); return raw error if rejected
  • Write — Call EventStore.Write; wrap storage errors as ErrPipelineFailed
  • Dispatch — Call Dispatcher.Dispatch to deliver the event through the bus

Validation errors short-circuit at phase 2; no event is written. Storage errors at phase 3 wrap to ErrPipelineFailed. Event dispatching uses the Dispatcher's per-aggregate ordered delivery via context.WithoutCancel to survive caller's deadline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandExecutor

type CommandExecutor[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](
	es *eventstore.EventStore[T],
	d *dispatcher.Dispatcher[T],
) *CommandExecutor[T]

func (*CommandExecutor[T]) Execute

func (e *CommandExecutor[T]) Execute(
	ctx context.Context,
	cmd asynxmd.Command[T],
	nextVersion int64,
	waitHandlers bool,
) (asynxmd.Event[T], error)

Jump to

Keyboard shortcuts

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