message

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompleteUserMessageState

type CompleteUserMessageState struct {
	UserMessageState
	Message
}

type Extension

type Extension struct {
	nibbler.NoOpExtension
	PersistenceExtension PersistenceExtension
	SessionExtension     *session.Extension
}

func (*Extension) DeleteUserMessageStateHandler

func (s *Extension) DeleteUserMessageStateHandler(w http.ResponseWriter, r *http.Request)

func (*Extension) GetMessagesHandler

func (s *Extension) GetMessagesHandler(w http.ResponseWriter, r *http.Request)

func (*Extension) GetName

func (s *Extension) GetName() string

func (*Extension) MarkUserMessageStateAsReadHandler

func (s *Extension) MarkUserMessageStateAsReadHandler(w http.ResponseWriter, r *http.Request)

func (*Extension) PostInit

func (s *Extension) PostInit(app *nibbler.Application) error

func (*Extension) SendMessageToUserHandler

func (s *Extension) SendMessageToUserHandler(w http.ResponseWriter, r *http.Request)

type Message

type Message struct {
	ID           string      `json:"id" bson:"_id" gorm:"primary_key"`
	CreatedAt    time.Time   `json:"createdAt"`
	UpdatedAt    time.Time   `json:"updatedAt"`
	DeletedAt    *time.Time  `json:"deletedAt,omitempty"`
	FromUserID   *string     `json:"fromUserId,omitempty"`
	FromUserName *string     `json:"fromUserName,omitempty"`
	Content      string      `json:"content"`
	Type         MessageType `json:"type"`
}

type MessageType

type MessageType int
const (
	GENERAL MessageType = iota
	ALERT
	SYSTEM
)

type PersistenceExtension

type PersistenceExtension interface {
	GetMessagesByUserId(userId string, count int, offset int) ([]CompleteUserMessageState, error)
	SendMessageToUser(userId string, message Message) error
	DeleteUserMessageState(messageStateId string, hardDelete bool) error
	MarkUserMessageStateAsRead(messageStateId string) error
}

type UserMessageState

type UserMessageState struct {
	ID        string     `json:"id" bson:"_id" gorm:"primary_key"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`
	UserID    string     `json:"userId"`
	ReadAt    *time.Time `json:"readAt,omitempty"`
}

Jump to

Keyboard shortcuts

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