123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package borealis
- import (
- "fmt"
- )
- type EventType uint16
- func GetEventType(payload interface{}) EventType {
- switch payload.(type) {
- case GrantAccess:
- return EventTypeGrantAccess
- case RegisterID:
- return EventTypeRegisterID
- case RevokeAccess:
- return EventTypeRevokeAccess
- case SendEmail:
- return EventTypeSendEmail
- case VerifyEmail:
- return EventTypeVerifyEmail
- default:
- return EventTypeUnknown
- }
- }
- func (type_ EventType) String() string {
- switch type_ {
- case EventTypeGrantAccess:
- return "GrantAccess"
- case EventTypeRegisterID:
- return "RegisterID"
- case EventTypeRevokeAccess:
- return "RevokeAccess"
- case EventTypeSendEmail:
- return "SendEmail"
- case EventTypeVerifyEmail:
- return "VerifyEmail"
- case EventTypeUnknown:
- return "Unknown"
- }
- return fmt.Sprintf("Unknown(%d)", int(type_))
- }
|