talk

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorEmptyContent   = "Content_is_empty"
	ErrorInvalidContent = "Content_is_invalid"
	ErrorOriginNotEmpty = "Origin_is_not_empty"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	// contains filtered or unexported fields
}

type DatabaseMessage

type DatabaseMessage struct {
	Canceled    bool     `rethinkdb:"canceled" json:"canceled"`
	CreatedTime int64    `rethinkdb:"createdTime" json:"createdTime"`
	Message     *Message `rethinkdb:"message" json:"message"`
	UUID        string   `rethinkdb:"id,omitempty" json:"uuid"`
}

type Manager

type Manager struct {
	Data
}

func NewManager

func NewManager(config Kernel.RethinkConfig, chatRoomID string) *Manager

func (*Manager) Check

func (manager *Manager) Check() bool

func (*Manager) Create

func (manager *Manager) Create() bool

func (*Manager) Drop

func (manager *Manager) Drop() bool

type Message

type Message struct {
	Content     string `rethinkdb:"content" json:"content"`
	ContentType int    `rethinkdb:"contentType" json:"contentType"`
	Origin      string `rethinkdb:"origin" json:"origin"`
}

type Service

type Service struct {
	Kernel.Service
	// contains filtered or unexported fields
}

Service: this is the struct of Talk Service.

func (*Service) CancelSentMessage

func (service *Service) CancelSentMessage(request *Kernel.Request)

CancelSentMessage: cancel a message delivery by the request of client.

func (*Service) CheckPermission

func (service *Service) CheckPermission() bool

CheckPermission: check the permission of client.

func (*Service) Fetch

func (service *Service) Fetch(ctx context.Context)

Fetch: do the fetch for data, if there is a change in database, it will throw the event out.

func (*Service) GetHistoryMessages

func (service *Service) GetHistoryMessages(request *Kernel.Request)

GetHistoryMessages: get the history messages for client.

func (*Service) GetMessage

func (service *Service) GetMessage(request *Kernel.Request)

GetMessage: get the message specific for client.

func (*Service) SendMessage

func (service *Service) SendMessage(request *Kernel.Request)

SendMessage: send a message by the request of client.

type ServiceInterface

type ServiceInterface interface {
	Kernel.ServiceInterface
	GetHistoryMessages(*Kernel.Request)
	GetMessage(*Kernel.Request)
	SendMessage(*Kernel.Request)
	CancelSentMessage(*Kernel.Request)
}

func NewServiceInterface

func NewServiceInterface(
	dbConfig Kernel.RethinkConfig,
	chatRoomID string,
	contentValidator func(int, string) bool,
	readMessagesHook func(*DatabaseMessage),
	sendMessageHook func(*DatabaseMessage),
) ServiceInterface

NewServiceInterface: create service interface of Talk.

Jump to

Keyboard shortcuts

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