Documentation
¶
Overview ¶
Package event provides concrete event types for the sync kit.
The Event struct is a ready-to-use implementation of the synckit/types.Event interface, with support for standard fields: ID, Type, AggregateID, Data, Metadata, and Timestamp. Use New() or NewWithMetadata() to create events.
See also:
- README: https://github.com/c0deZ3R0/go-sync-kit#readme
- Architecture overview: https://github.com/c0deZ3R0/go-sync-kit/blob/main/docs/overview.md
Package event provides concrete event types for the sync kit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
// EventID is the unique identifier for this event
EventID string `json:"id"`
// EventType represents the event type (e.g., "UserCreated", "OrderUpdated")
EventType string `json:"type"`
// EventAggregateID is the ID of the aggregate this event belongs to
EventAggregateID string `json:"aggregate_id"`
// EventData contains the event payload as raw bytes
EventData []byte `json:"data"`
// EventMetadata contains additional event metadata
EventMetadata map[string]interface{} `json:"metadata,omitempty"`
// Timestamp records when the event was created
Timestamp time.Time `json:"timestamp"`
// Offset is set by the event store to track event ordering
Offset int64 `json:"offset,omitempty"`
}
Event represents a concrete implementation of the Event interface. It provides a simple, ready-to-use event structure for most use cases.
func NewWithMetadata ¶
func NewWithMetadata(id, eventType, aggregateID string, data []byte, metadata map[string]interface{}) *Event
NewWithMetadata creates a new Event with the given parameters and metadata.
func (*Event) AggregateID ¶
AggregateID returns the ID of the aggregate this event belongs to.