eventcodec

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const OccurredAtLayout = "2006-01-02T15:04:05.000Z07:00"

Variables

This section is empty.

Functions

func DecodeDomainEvent

func DecodeDomainEvent(payload []byte) (event.DomainEvent, error)

func EncodeDomainEvent

func EncodeDomainEvent(evt event.DomainEvent) ([]byte, error)

func MetadataFromEvent

func MetadataFromEvent(evt event.DomainEvent, source string) map[string]string

Types

type Envelope

type Envelope struct {
	ID            string          `json:"id"`
	EventType     string          `json:"eventType"`
	OccurredAt    time.Time       `json:"occurredAt"`
	AggregateType string          `json:"aggregateType"`
	AggregateID   string          `json:"aggregateID"`
	Data          json.RawMessage `json:"data"`
}

func DecodeEnvelope

func DecodeEnvelope(payload []byte) (*Envelope, error)

type PayloadDecoder

type PayloadDecoder func([]byte) (event.DomainEvent, error)

type PayloadEncoder

type PayloadEncoder func(event.DomainEvent) ([]byte, error)

Jump to

Keyboard shortcuts

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