mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-07 09:54:56 +01:00
23 lines
383 B
Go
23 lines
383 B
Go
package pubsub
|
|
|
|
const (
|
|
CreatedEvent EventType = "created"
|
|
UpdatedEvent EventType = "updated"
|
|
DeletedEvent EventType = "deleted"
|
|
)
|
|
|
|
type (
|
|
// EventType identifies the type of event
|
|
EventType string
|
|
|
|
// Event represents an event in the lifecycle of a resource
|
|
Event[T any] struct {
|
|
Type EventType
|
|
Payload T
|
|
}
|
|
|
|
Publisher[T any] interface {
|
|
Publish(EventType, T)
|
|
}
|
|
)
|