events.go

 1package pubsub
 2
 3const (
 4	CreatedEvent EventType = "created"
 5	UpdatedEvent EventType = "updated"
 6	DeletedEvent EventType = "deleted"
 7)
 8
 9type (
10	// EventType identifies the type of event
11	EventType string
12
13	// Event represents an event in the lifecycle of a resource
14	Event[T any] struct {
15		Type    EventType
16		Payload T
17	}
18
19	Publisher[T any] interface {
20		Publish(EventType, T)
21	}
22)