Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEventTypeRequired = fmt.Errorf("event type is required")
ErrEventTypeRequired is returned when an event type is required but not provided
Functions ¶
Types ¶
type Event ¶
type Event struct {
ID string `json:"id" example:"event-uuid"`
NID int64 `json:"nid" example:"1"`
CreatedAt time.Time `json:"created_at" example:"2023-01-01T00:00:00Z"`
EventType string `json:"event_type" example:"github.pull_request"`
EventSource string `json:"event_source" example:"github.com"`
AggregateID string `json:"aggregate_id" example:"aggregate-uuid"`
AggregateType string `json:"aggregate_type" example:"github.webhook"`
Version int `json:"version" example:"1"`
Data json.RawMessage `json:"data" example:"{}"`
Metadata json.RawMessage `json:"metadata" example:"{}"`
}
Event represents a stored event without exposing partition details
type Store ¶
type Store interface {
AppendEvent(ctx context.Context, event *Event) error
GetEventsByAggregate(ctx context.Context, eventType string, from, to time.Time, aggregateType, aggregateID string, limit int) ([]Event, error)
GetEventsByType(ctx context.Context, eventType string, from, to time.Time, limit int) ([]Event, error)
GetEventsBySource(ctx context.Context, eventType string, from, to time.Time, eventSource string, limit int) ([]Event, error)
GetEventTypesInRange(ctx context.Context, from, to time.Time, limit int) ([]string, error)
DeleteEventsByTypeInRange(ctx context.Context, eventType string, from, to time.Time) error
EnsurePartitionExists(ctx context.Context, ts time.Time) error
}
Store provides methods for storing and retrieving events
Click to show internal directories.
Click to hide internal directories.