event

package
v0.0.0-...-b6b6a87 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseEvent

type BaseEvent struct {
	MEventID     string
	MAggregateID string
	MOccurredOn  time.Time
}

func NewBaseEvent

func NewBaseEvent(aggregateID string) BaseEvent

func (BaseEvent) AggregateID

func (b BaseEvent) AggregateID() string

func (BaseEvent) ID

func (b BaseEvent) ID() string

func (BaseEvent) OccurredOn

func (b BaseEvent) OccurredOn() time.Time

type Bus

type Bus interface {
	// Publish is the method used to publish new events.
	Publish(context.Context, []Event) error
	// Subscribe is the method used to subscribe new event handlers.
	Subscribe(Type, Handler)
	Close() error
}

Bus defines the expected behaviour from an event bus.

type Event

type Event interface {
	ID() string
	AggregateID() string
	OccurredOn() time.Time
	Type() Type
}

Event represents a domain command.

type Handler

type Handler interface {
	Handle(context.Context, Event) error
}

Handler defines the expected behaviour from an event handler.

type Type

type Type string

Type represents a domain event type.

Jump to

Keyboard shortcuts

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