event

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ChangeStatus = "ChangeStatus"
View Source
const ChatGroup = "ChatEvent"

Event group name

View Source
const Invite = "INVITE"

Event Names

View Source
const InviteReceived = "RECEIVED"
View Source
const InviteSent = "SENT"

Event Actions

View Source
const MessageGroup = "messaging"
View Source
const NewMessage = "NewMessage"

Variables

View Source
var ErrNotSupported = errors.New("not implemented")
View Source
var MessagingEG = NewMessagingEventGroup()
View Source
var NewChatEvent = NewEvtObj[string, interface{}]
View Source
var NewExternalEvent = NewEvtObj[string, string]
View Source
var NewMessageEvent = NewEvtObj[entity.Status, interface{}]

Functions

func EmitInvite added in v0.3.0

func EmitInvite(bus event.Bus, action string, chat entity.ChatInfo)

func EmitMessageChange added in v0.3.0

func EmitMessageChange(bus event.Bus, status entity.Status, msgID string)

func EmitNewMessage added in v0.3.0

func EmitNewMessage(bus event.Bus, msg entity.Message)

Types

type ChatEvent added in v0.3.0

type ChatEvent = IEvent[string, interface{}]

type ChatEventGroup added in v0.3.0

type ChatEventGroup = IEventGroup[string, interface{}]

func NewChatEventGroup added in v0.3.0

func NewChatEventGroup() ChatEventGroup

type ChatEventObj added in v0.3.0

type ChatEventObj = EvtObject[string, interface{}]

type Empty added in v0.3.0

type Empty struct{}

type EvtObject

type EvtObject[A any, P any] struct {
	// contains filtered or unexported fields
}

func (EvtObject[A, P]) Action

func (e EvtObject[A, P]) Action() A

func (EvtObject[A, P]) Group

func (e EvtObject[A, P]) Group() string

func (EvtObject[A, P]) Name

func (e EvtObject[A, P]) Name() string

func (EvtObject[A, P]) Payload

func (e EvtObject[A, P]) Payload() P

type ExternalEvent added in v0.3.0

type ExternalEvent = IEvent[string, string]

type ExternalEventObj added in v0.3.0

type ExternalEventObj = EvtObject[string, string]

type IEvent added in v0.3.0

type IEvent[A any, P any] interface {
	Name() string
	Group() string
	Action() A
	Payload() P
}

func NewEvtObj

func NewEvtObj[A any, P any](n string, g string, a A, p P) IEvent[A, P]

type IEventGroup added in v0.3.0

type IEventGroup[A any, P any] interface {
	NewEvent(name string, action A, payload P) (IEvent[A, P], error)
	Validate(IEvent[A, P]) bool
}

type MessageEvent added in v0.3.0

type MessageEvent = IEvent[entity.Status, interface{}]

type MessageEventGroup added in v0.3.0

type MessageEventGroup = IEventGroup[entity.Status, interface{}]

func NewMessagingEventGroup

func NewMessagingEventGroup() MessageEventGroup

type MessageEventObj added in v0.3.0

type MessageEventObj = EvtObject[entity.Status, interface{}]

type Publishable added in v0.3.0

type Publishable interface {
	Cast() ExternalEvent
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL