Documentation
¶
Overview ¶
Package fixtures is a set of test fixtures and mocks for in-memory projections.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageHandler ¶
type MessageHandler[T any] struct { ConfigureFunc func(dogma.ProjectionConfigurer) HandleEventFunc func(T, dogma.ProjectionEventScope, dogma.Message) (T, error) CompactFunc func(T, dogma.ProjectionCompactScope) T }
MessageHandler is a test implementation of [memoryprojection.MessageHandler].
func (*MessageHandler[T]) Compact ¶
func (h *MessageHandler[T]) Compact(v T, s dogma.ProjectionCompactScope) T
Compact reduces the size of the projection's data.
If h.CompactFunc is non-nil, it returns h.CompactFunc(v, s). Otherwise, it returns v unmodified.
func (*MessageHandler[T]) Configure ¶
func (h *MessageHandler[T]) Configure(c dogma.ProjectionConfigurer)
Configure configures the behavior of the engine as it relates to this handler.
c provides access to the various configuration options, such as specifying which types of event messages are routed to this handler.
If h.ConfigureFunc is non-nil, it calls h.ConfigureFunc(c).
func (*MessageHandler[T]) HandleEvent ¶
func (h *MessageHandler[T]) HandleEvent( v T, s dogma.ProjectionEventScope, m dogma.Message, ) (T, error)
HandleEvent handles a domain event message that has been routed to this handler.
If h.HandleEventFunc is non-nil, it returns h.HandleEventFunc(v, s, m). Otherwise, it returns v unmodified.