Versions in this module Expand all Collapse all v0 v0.1.5 Jun 8, 2022 v0.1.1 Jun 8, 2022 Changes in this version + var ErrEventInternal = errors.Define("event.internal") + var ErrEventPayloadSerialization = errors.Define("event.payload_serialization") + var ErrInvalidEvent = errors.Define("event.invalid") + type Event struct + func CreateEvent(entityId string, topic string, payload interface{}) (*Event, error) + func NewEvent(id string, entityId string, topic string, payload []byte, timestamp time.Time) (*Event, error) + func (e *Event) EntityId() string + func (e *Event) Id() string + func (e *Event) Payload() []byte + func (e *Event) Timestamp() time.Time + func (e *Event) Topic() string + func (e *Event) UnmarshalPayload(v interface{}) error + type EventCollector struct + func CreateEventCollector() *EventCollector + func NewEventCollector(events []*Event) *EventCollector + func (c *EventCollector) All() []*Event + func (c *EventCollector) Drain() []*Event + func (c *EventCollector) Record(p Publishable) error + type Handler interface + Handle func(ctx context.Context, event *Event) error + type LocalEventBus struct + func NewLocalEventBus() *LocalEventBus + func (eb *LocalEventBus) Publish(ctx context.Context, events ...*Event) error + func (eb *LocalEventBus) Subscribe(ctx context.Context, subject string, handler Handler) error + type NatsEvent struct + EntityId string + Id string + Payload []byte + Timestamp time.Time + Topic string + type NatsEventBus struct + func NewNatsEventBus(consumerGroup string, conn *nats.Conn) *NatsEventBus + func (eb *NatsEventBus) Publish(ctx context.Context, events ...*Event) error + func (eb *NatsEventBus) Subscribe(ctx context.Context, subject string, handler Handler) error + type Publishable interface + Id func() string + Topic func() string + type Publisher interface + Publish func(ctx context.Context, events ...*Event) error + type Subscriber interface + Subscribe func(ctx context.Context, subject string, handler Handler) error Other modules containing this package github.com/aboglioli/libs