Documentation ¶
Index ¶
- Variables
- type ErrEventReqChNotSet
- type ErrNewEvent
- type ErrNilVerifyFunc
- type ErrUnregisteredEvent
- type Event
- type EventAccountAuthenticatedPayload
- type EventAccountCreatedPayload
- type EventAccountDeletedPayload
- type EventInfo
- type EventMeta
- type EventName
- type EventPolicyUpdatedPayload
- type EventPublisher
- type EventRegistry
- type EventUpsertPolicyPayload
- type IEvent
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNilNATSConnObj = errors.New("nil nats conn obj received") ErrInvalidPayload = errors.New("invalid payload") ErrUnsupportedEvent = errors.New("unsupported event") )
Errors of event package
View Source
var Registry = &EventRegistry{ Registry: make(map[EventName]EventInfo), }
Registry is the service EventRegistry where all the active events which are to be fired or handled must register themselves
Functions ¶
This section is empty.
Types ¶
type ErrEventReqChNotSet ¶
type ErrEventReqChNotSet struct {
Name EventName
}
func (*ErrEventReqChNotSet) Error ¶
func (e *ErrEventReqChNotSet) Error() string
type ErrNewEvent ¶
type ErrNewEvent struct {
Name EventName
}
func (*ErrNewEvent) Error ¶
func (e *ErrNewEvent) Error() string
type ErrNilVerifyFunc ¶
type ErrNilVerifyFunc struct {
Name EventName
}
func (*ErrNilVerifyFunc) Error ¶
func (e *ErrNilVerifyFunc) Error() string
type ErrUnregisteredEvent ¶
type ErrUnregisteredEvent struct {
Name EventName
}
func (*ErrUnregisteredEvent) Error ¶
func (e *ErrUnregisteredEvent) Error() string
type Event ¶
type Event struct { Meta EventMeta `json:"meta"` Payload interface{} `json:"payload"` }
func (*Event) GetPayload ¶
func (e *Event) GetPayload() interface{}
type EventAccountAuthenticatedPayload ¶
type EventAccountAuthenticatedPayload struct {
AccntID uint `json:"accnt_id"`
}
type EventAccountDeletedPayload ¶
type EventAccountDeletedPayload struct {
AccntID uint `json:"accnt_id"`
}
type EventName ¶
type EventName string
const EventAccountAuthenticated EventName = "EventAccountAuthenticated"
const EventAccountCreated EventName = "EventAccountCreated"
const EventAccountDeleted EventName = "EventAccountDeleted"
const EventPolicyUpdated EventName = "EventPolicyUpdated"
const EventUpsertPolicy EventName = "EventUpsertPolicy"
type EventPublisher ¶
type EventPublisher struct {
// contains filtered or unexported fields
}
EventPublisher makes it easy to add events and send them all at once
func NewEventPublisher ¶
func NewEventPublisher() *EventPublisher
func (*EventPublisher) GetEventNames ¶
func (ep *EventPublisher) GetEventNames() (names []string)
func (*EventPublisher) Publish ¶
func (ep *EventPublisher) Publish(nc *nats.EncodedConn) error
Publish publishes the added events to registered NATS subjects if error occurs while publishing any event, the publisher returns the error immediately instead of try publishing other events
type EventRegistry ¶
Registry holds all the event name and their transport details mapping It helps in verifying the event name and getting their request/response channel
func (*EventRegistry) GetEventInfo ¶
func (er *EventRegistry) GetEventInfo(name EventName) (EventInfo, error)
Click to show internal directories.
Click to hide internal directories.