events

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatCreatedEvent

type ChatCreatedEvent struct {
	*ChatEvent
}

ChatCreatedEvent ...

func NewChatCreatedEvent

func NewChatCreatedEvent(chatname string, t time.Time) *ChatCreatedEvent

NewChatCreatedEvent ...

func (*ChatCreatedEvent) String

func (ce *ChatCreatedEvent) String() string

type ChatEvent

type ChatEvent struct {
	models.Chat
	Time models.UnixTime
}

ChatEvent is always global event.

func NewChatEvent

func NewChatEvent(chatname string, t time.Time) *ChatEvent

NewChatEvent ...

func (*ChatEvent) InChat

func (ce *ChatEvent) InChat() (string, error)

InChat global event.

func (*ChatEvent) String

func (ce *ChatEvent) String() string

type ChatJoinEvent

type ChatJoinEvent struct {
	*UserEvent
	models.UserStatus
}

ChatJoinEvent used to emit when user joins chat (ie to db.Chat)

func NewChatJoinEvent

func NewChatJoinEvent(username string, chatname string, time time.Time) *ChatJoinEvent

NewChatJoinEvent ...

func (*ChatJoinEvent) String

func (ce *ChatJoinEvent) String() string

func (*ChatJoinEvent) WithStatus

func (ce *ChatJoinEvent) WithStatus(status models.UserStatus) *ChatJoinEvent

WithStatus ...

type ChatLeaveEvent

type ChatLeaveEvent struct {
	*UserEvent
}

ChatLeaveEvent used to emit when user leaves chat (ie from db.Chat)

func NewChatLeaveEvent

func NewChatLeaveEvent(username string, chatname string, time time.Time) *ChatLeaveEvent

NewChatLeaveEvent ...

func (*ChatLeaveEvent) String

func (ce *ChatLeaveEvent) String() string

type ChatRemovedEvent

type ChatRemovedEvent struct {
	*ChatEvent
}

ChatRemovedEvent ...

func NewChatRemovedEvent

func NewChatRemovedEvent(chatname string, t time.Time) *ChatRemovedEvent

NewChatRemovedEvent ...

func (*ChatRemovedEvent) String

func (ce *ChatRemovedEvent) String() string

type Event

type Event interface {
	fmt.Stringer
	// should return chat this event occured in
	// if it's global, should return "", er.ErrGlobalEvent
	InChat() (string, error)
}

Event ...

type EventWithType

type EventWithType struct {
	Event `json:"event"`

	Type string `json:"type"`
}

EventWithType represents event with reflected Type Very convinient to json marshalling for example

func NewEventWithType

func NewEventWithType(e Event) EventWithType

NewEventWithType constructs EventWithType from Event

type LoginEvent

type LoginEvent struct {
	*UserEvent
}

LoginEvent used to emit when user logins chat globally (ie to db.LoggedDB)

func NewLoginEvent

func NewLoginEvent(username string, chatname string, time time.Time) *LoginEvent

NewLoginEvent ...

func (*LoginEvent) String

func (le *LoginEvent) String() string

type LogoutEvent

type LogoutEvent struct {
	*UserEvent
}

LogoutEvent used to emit when user logouts globally (ie from db.LoggedDB)

func NewLogoutEvent

func NewLogoutEvent(username string, chatname string, time time.Time) *LogoutEvent

NewLogoutEvent ...

func (*LogoutEvent) String

func (le *LogoutEvent) String() string

type MessageEvent

type MessageEvent struct {
	*models.Message
}

MessageEvent ...

func NewMessageEvent

func NewMessageEvent(msg *models.Message) *MessageEvent

NewMessageEvent ...

func (*MessageEvent) String

func (e *MessageEvent) String() string

type SystemMessageChatJoinEvent

type SystemMessageChatJoinEvent struct {
	*SystemMessageEvent
}

SystemMessageChatJoinEvent ...

func NewSystemMessageChatJoinEvent

func NewSystemMessageChatJoinEvent(chatname, username string, t models.UnixTime) *SystemMessageChatJoinEvent

NewSystemMessageChatJoinEvent ...

func (*SystemMessageChatJoinEvent) String

func (e *SystemMessageChatJoinEvent) String() string

type SystemMessageChatLeaveEvent

type SystemMessageChatLeaveEvent struct {
	*SystemMessageEvent
}

SystemMessageChatLeaveEvent ...

func NewSystemMessageChatLeaveEvent

func NewSystemMessageChatLeaveEvent(chatname, username string, t models.UnixTime) *SystemMessageChatLeaveEvent

NewSystemMessageChatLeaveEvent ...

func (*SystemMessageChatLeaveEvent) String

func (e *SystemMessageChatLeaveEvent) String() string

type SystemMessageEvent

type SystemMessageEvent struct {
	models.Chat
	models.User
	Time models.UnixTime `json:"time"`
}

SystemMessageEvent ...

func (*SystemMessageEvent) String

func (e *SystemMessageEvent) String() string

type UserEvent

type UserEvent struct {
	models.User
	models.Chat
	Time models.UnixTime
}

UserEvent ...

func NewUserEvent

func NewUserEvent(username string, chatname string, time time.Time) *UserEvent

NewUserEvent ...

func (*UserEvent) String

func (ue *UserEvent) String() string

Jump to

Keyboard shortcuts

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