message

package
v0.0.0-...-f6d4ea8 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionMessage = "message"
)

Variables

This section is empty.

Functions

func InsertContentMessage

func InsertContentMessage(m *proto.Message, sent bool) error

func InsertContentMessageAck

func InsertContentMessageAck(m *proto.Message, sent bool) error

func InsertMessage

func InsertMessage(m *Message) error

func InsertNotification

func InsertNotification(m *proto.Message, sent bool) error

func UpdateMessageSent

func UpdateMessageSent(mid string, sent bool) error

Types

type Message

type Message struct {
	BId        primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	Version    int                `bson:"version"`
	Id         string             `bson:"id"`
	AppId      string             `bson:"appId"`
	FromUserId string             `bson:"fromUserId"` /* 发送方的id,如果是服务器下发的消息,则为空 */
	ToUserId   string             `bson:"toUserId"`   /* 目标用户的Id */
	Type       int                `bson:"type"`
	Sent       bool               `bson:"sent"` /* 是否已经发送成功,部分数据需要ack响应后才更新该字段 */

	STime time.Time `bson:"stime"` /* 发送成功的时间 */
	CTime time.Time `bson:"ctime"`

	Content map[string]interface{} `bson:"content""`
	NeedAck bool                   `bson:"need_ack"`
}

func FindMessageUnsent

func FindMessageUnsent(appId, userId string, st time.Time) ([]*Message, error)

获取针对某一用户,未发送成功的消息

func GetMessageById

func GetMessageById(id string) (*Message, error)

Jump to

Keyboard shortcuts

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