Documentation
¶
Overview ¶
Package chain provides interfaces for ordered processing of data through stages. Chains allow modifications to be applied in a predictable order, making complex game mechanics composable and testable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain[T any] interface { // Add registers a modifier at the specified stage with a unique ID. // Returns an error if the ID already exists. Add(stage Stage, id string, modifier func(context.Context, T) (T, error)) error // Remove unregisters a modifier by its ID. // Returns an error if the ID does not exist. Remove(id string) error // Execute runs all modifiers in stage order, transforming the data. Execute(ctx context.Context, data T) (T, error) }
Chain processes data through ordered stages of modifications. Each modification transforms the data and passes it to the next.
Click to show internal directories.
Click to hide internal directories.