hook

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package hook lets package aggregate hand its bookkeeping to internal/aggregateaccess without exporting it.

aggregate registers a lookup at init time. aggregateaccess imports aggregate, so the lookup is always registered before it is used. Like aggregate itself, this package imports only the stdlib and uuid.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(lookup func(r any) *State)

Register installs the lookup from an aggregate Root to its State. Only package aggregate calls it.

Types

type Event

type Event interface {
	EventType() string
}

Event mirrors aggregate.Event; both interfaces are mutually assignable.

type State

type State struct {
	ID          uuid.UUID
	Version     int
	Uncommitted []Event
}

State is the bookkeeping that aggregate.Base embeds.

func StateOf

func StateOf(r any) *State

StateOf returns the State embedded in the aggregate Root r.

Jump to

Keyboard shortcuts

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