eventformatter

package
v0.3.6-dev23 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseEventFormatter

type BaseEventFormatter struct {
	EsClient esApi.EventStoreClient
}

BaseEventFormatter is the base implementation for all event formatters

func (*BaseEventFormatter) AppendUpdate

func (f *BaseEventFormatter) AppendUpdate(field string, update string, old string, strBuilder *strings.Builder)

AppendUpdate appends updates to a string builder in human-readable format

func (*BaseEventFormatter) CreateSnapshot

func (f *BaseEventFormatter) CreateSnapshot(ctx context.Context, projector es.Projector, eventFilter *esApi.EventFilter) (es.Projection, error)

CreateSnapshot creates a snapshot based on an event-filter and the corresponding projector for the aggregate of which the id is used in the filter. This is a temporary implementation until snapshots are fully implemented, and it is not meant to be used extensively.

type EventFormatter

type EventFormatter interface {
	// GetFormattedDetails formats a given event in a human-readable format
	GetFormattedDetails(context.Context, *esApi.Event) (string, error)
}

EventFormatter is the interface definition for all event formatters

type EventFormatterRegistry

type EventFormatterRegistry interface {
	// RegisterEventFormatter registers an event-formatter factory for an event-type.
	RegisterEventFormatter(es.EventType, func(esApi.EventStoreClient) EventFormatter) error
	// CreateEventFormatter returns the event-formatter of the event-type registered with RegisterEventFormatter.
	CreateEventFormatter(esApi.EventStoreClient, es.EventType) (EventFormatter, error)
}

EventFormatterRegistry is the interface definition for an event-formatter registry

var DefaultEventFormatterRegistry EventFormatterRegistry

func NewEventFormatterRegistry

func NewEventFormatterRegistry() EventFormatterRegistry

NewEventFormatterRegistry creates a new event-formatter registry

Jump to

Keyboard shortcuts

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