Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateId ¶
type AggregateId string
const ( AuthAggregate AggregateId = "auth" UserAggregate AggregateId = "user" ArticleAggregate AggregateId = "article" CommentAggregate AggregateId = "comment" )
type Event ¶
type Event struct { AggregateId AggregateId `json:"aggregate_id,omitempty"` Type EventType `json:"type,omitempty"` Body []byte `json:"body,omitempty"` // Must be marshaled to JSON. Timestamp time.Time `json:"timestamp,omitempty"` Metadata map[string]string // TraceID etc. }
Events are sent to the queue in JSON format.
type EventType ¶
type EventType string
All event names must be lowercase and follow the structure: "{noun}-{action}". Eg. article-created, notification-sent, order-accepted. For longer names use snake-case naming. Eg. changed_password_notification-sent.
const ( ArticleCreated EventType = "article-created" ArticleDeleted EventType = "article-deleted" ArticleUpdated EventType = "article-updated" UserCreated EventType = "user-created" UserDeleted EventType = "user-deleted" UserUpdated EventType = "user-updated" UserLoggedIn EventType = "user-logged_in" UserLoggedOut EventType = "user-logged_out" KeySetUpdated EventType = "key_set-updated" )
type HandlerFunc ¶
type HandlerFunc func(Event)
func (HandlerFunc) Handle ¶
func (fn HandlerFunc) Handle(event Event)
type Subscriber ¶
Click to show internal directories.
Click to hide internal directories.