unrelation

package
v3.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Msg        = "msg"
	OldestList = 0
	NewestList = -1
)
View Source
const (
	SubscribeUser = "subscribe_user"
)

SubscribeUser collection constant.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonUserModel

type CommonUserModel struct {
	UserID   string `bson:"user_id"`
	UserName string `bson:"user_name"`
}

type GroupCount

type GroupCount struct {
	GroupID string `bson:"group_id"`
	Count   int64  `bson:"count"`
}

type MsgDataModel

type MsgDataModel struct {
	SendID           string            `bson:"send_id"`
	RecvID           string            `bson:"recv_id"`
	GroupID          string            `bson:"group_id"`
	ClientMsgID      string            `bson:"client_msg_id"`
	ServerMsgID      string            `bson:"server_msg_id"`
	SenderPlatformID int32             `bson:"sender_platform_id"`
	SenderNickname   string            `bson:"sender_nickname"`
	SenderFaceURL    string            `bson:"sender_face_url"`
	SessionType      int32             `bson:"session_type"`
	MsgFrom          int32             `bson:"msg_from"`
	ContentType      int32             `bson:"content_type"`
	Content          string            `bson:"content"`
	Seq              int64             `bson:"seq"`
	SendTime         int64             `bson:"send_time"`
	CreateTime       int64             `bson:"create_time"`
	Status           int32             `bson:"status"`
	IsRead           bool              `bson:"is_read"`
	Options          map[string]bool   `bson:"options"`
	OfflinePush      *OfflinePushModel `bson:"offline_push"`
	AtUserIDList     []string          `bson:"at_user_id_list"`
	AttachedInfo     string            `bson:"attached_info"`
	Ex               string            `bson:"ex"`
}

type MsgDocModel

type MsgDocModel struct {
	DocID string          `bson:"doc_id"`
	Msg   []*MsgInfoModel `bson:"msgs"`
}

func (MsgDocModel) GenExceptionMessageBySeqs

func (MsgDocModel) GenExceptionMessageBySeqs(seqs []int64) (exceptionMsg []*sdkws.MsgData)

func (MsgDocModel) GetDocID

func (m MsgDocModel) GetDocID(conversationID string, seq int64) string

func (MsgDocModel) GetDocIDSeqsMap

func (m MsgDocModel) GetDocIDSeqsMap(conversationID string, seqs []int64) map[string][]int64

func (MsgDocModel) GetMsgIndex

func (m MsgDocModel) GetMsgIndex(seq int64) int64

func (MsgDocModel) GetSingleGocMsgNum

func (MsgDocModel) GetSingleGocMsgNum() int64

func (MsgDocModel) GetSingleGocMsgNum5000

func (MsgDocModel) GetSingleGocMsgNum5000() int64

func (*MsgDocModel) IsFull

func (m *MsgDocModel) IsFull() bool

func (MsgDocModel) TableName

func (MsgDocModel) TableName() string

type MsgDocModelInterface

type MsgDocModelInterface interface {
	PushMsgsToDoc(ctx context.Context, docID string, msgsToMongo []MsgInfoModel) error
	Create(ctx context.Context, model *MsgDocModel) error
	UpdateMsg(ctx context.Context, docID string, index int64, key string, value any) (*mongo.UpdateResult, error)
	PushUnique(ctx context.Context, docID string, index int64, key string, value any) (*mongo.UpdateResult, error)
	UpdateMsgContent(ctx context.Context, docID string, index int64, msg []byte) error
	IsExistDocID(ctx context.Context, docID string) (bool, error)
	FindOneByDocID(ctx context.Context, docID string) (*MsgDocModel, error)
	GetMsgBySeqIndexIn1Doc(ctx context.Context, userID, docID string, seqs []int64) ([]*MsgInfoModel, error)
	GetNewestMsg(ctx context.Context, conversationID string) (*MsgInfoModel, error)
	GetOldestMsg(ctx context.Context, conversationID string) (*MsgInfoModel, error)
	DeleteDocs(ctx context.Context, docIDs []string) error
	GetMsgDocModelByIndex(ctx context.Context, conversationID string, index, sort int64) (*MsgDocModel, error)
	DeleteMsgsInOneDocByIndex(ctx context.Context, docID string, indexes []int) error
	MarkSingleChatMsgsAsRead(ctx context.Context, userID string, docID string, indexes []int64) error
	SearchMessage(ctx context.Context, req *msg.SearchMessageReq) (int32, []*MsgInfoModel, error)
	RangeUserSendCount(
		ctx context.Context,
		start time.Time,
		end time.Time,
		group bool,
		ase bool,
		pageNumber int32,
		showNumber int32,
	) (msgCount int64, userCount int64, users []*UserCount, dateCount map[string]int64, err error)
	RangeGroupSendCount(
		ctx context.Context,
		start time.Time,
		end time.Time,
		ase bool,
		pageNumber int32,
		showNumber int32,
	) (msgCount int64, userCount int64, groups []*GroupCount, dateCount map[string]int64, err error)
	ConvertMsgsDocLen(ctx context.Context, conversationIDs []string)
}

type MsgInfoModel

type MsgInfoModel struct {
	Msg     *MsgDataModel `bson:"msg"`
	Revoke  *RevokeModel  `bson:"revoke"`
	DelList []string      `bson:"del_list"`
	IsRead  bool          `bson:"is_read"`
}

type OfflinePushModel

type OfflinePushModel struct {
	Title         string `bson:"title"`
	Desc          string `bson:"desc"`
	Ex            string `bson:"ex"`
	IOSPushSound  string `bson:"ios_push_sound"`
	IOSBadgeCount bool   `bson:"ios_badge_count"`
}

type RevokeModel

type RevokeModel struct {
	Role     int32  `bson:"role"`
	UserID   string `bson:"user_id"`
	Nickname string `bson:"nickname"`
	Time     int64  `bson:"time"`
}

type UserCount

type UserCount struct {
	UserID string `bson:"user_id"`
	Count  int64  `bson:"count"`
}

type UserModel

type UserModel struct {
	UserID     string   `bson:"user_id"      json:"userID"`
	UserIDList []string `bson:"user_id_list" json:"userIDList"`
}

UserModel collection structure.

func (UserModel) TableName

func (UserModel) TableName() string

type UserModelInterface

type UserModelInterface interface {
	// AddSubscriptionList Subscriber's handling of thresholds.
	AddSubscriptionList(ctx context.Context, userID string, userIDList []string) error
	// UnsubscriptionList Handling of unsubscribe.
	UnsubscriptionList(ctx context.Context, userID string, userIDList []string) error
	// RemoveSubscribedListFromUser Among the unsubscribed users, delete the user from the subscribed list.
	RemoveSubscribedListFromUser(ctx context.Context, userID string, userIDList []string) error
	// GetAllSubscribeList Get all users subscribed by this user
	GetAllSubscribeList(ctx context.Context, id string) (userIDList []string, err error)
	// GetSubscribedList Get the user subscribed by those users
	GetSubscribedList(ctx context.Context, id string) (userIDList []string, err error)
}

UserModelInterface Operation interface of user mongodb.

Jump to

Keyboard shortcuts

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