Documentation
¶
Index ¶
Constants ¶
View Source
const ( Created = "created" Updated = "updated" Deleted = "deleted" )
Event names
Variables ¶
This section is empty.
Functions ¶
func HasEventHandler ¶
func SendEvents ¶ added in v0.368.0
SendEvents will gather, create and send events which have occurred within the scope of this context. It achieves this by inspecting the keel_audit table for rows which must be generated into events, updates the event_processed_at field on these rows, and then calls the event handler for each event.
func WithEventHandler ¶
Types ¶
type Event ¶
type Event struct {
// The name of the event, e.g. member.created.
EventName string `json:"eventName"`
// The time at which the event was created.
OccurredAt time.Time `json:"occurredAt"`
// The identity that resulted in the triggered events.
IdentityId string `json:"identityId,omitempty"`
// The target impacted by this event.
Target *EventTarget `json:"target"`
}
type EventHandler ¶
type EventHandler func(ctx context.Context, subscriber string, event *Event, traceparent string) error
The event handler function to be executed for each subscriber event generated.
func GetEventHandler ¶
func GetEventHandler(ctx context.Context) (EventHandler, error)
type EventTarget ¶
type EventTarget struct {
// The id of the target, if applicable.
Id string `json:"id"`
// The type of event target, e.g. Employee
Type string `json:"type"`
// The model data at the time of the event.
Data map[string]any `json:"data"`
// The previous state of the model data before the event.
PreviousData map[string]any `json:"previousData"`
}
Click to show internal directories.
Click to hide internal directories.