Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Define events Created Event = "created" Updated Event = "updated" Deleted Event = "deleted" // Define scopes UserScope Scope = "user" // Event source SourceUserAPI = "user_api" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventPayload ¶
type Hooker ¶
type Hooker struct { Subscribers []Subscriber ScopedSubscribers map[Scope][]Subscriber }
func CreateHooker ¶
func CreateHooker() *Hooker
func (*Hooker) AddScopedSubscriber ¶
func (h *Hooker) AddScopedSubscriber(scope Scope, subscriber Subscriber)
func (*Hooker) AddSubscriber ¶
func (h *Hooker) AddSubscriber(subscriber Subscriber)
func (*Hooker) Trigger ¶
func (h *Hooker) Trigger(payload EventPayload)
func (*Hooker) TriggerScopedSubscriber ¶
func (h *Hooker) TriggerScopedSubscriber(payload EventPayload)
type HookerInterface ¶
type HookerInterface interface { Trigger(event Event, payload interface{}) AddSubscriber(scope Scope, subscriber Subscriber) }
type RawEventPayload ¶
type Subscriber ¶
type Subscriber interface { Created(payload EventPayload) Updated(payload EventPayload) Deleted(payload EventPayload) }
Click to show internal directories.
Click to hide internal directories.