You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/pkg/common/db/controller/msg.go

44 lines
2.1 KiB

2 years ago
package controller
2 years ago
import (
"Open_IM/pkg/proto/msg"
2 years ago
pbMsg "Open_IM/pkg/proto/msg"
2 years ago
"Open_IM/pkg/proto/sdkws"
2 years ago
"context"
)
type MsgInterface interface {
//消息写入队列
MsgToMQ(ctx context.Context, key string, m *msg.MsgDataToMQ) error
2 years ago
BatchInsertChat2DB(ctx context.Context, userID string, msgList []*pbMsg.MsgDataToMQ, currentMaxSeq uint64) error
BatchInsertChat2Cache(ctx context.Context, insertID string, msgList []*pbMsg.MsgDataToMQ) (error, uint64)
2 years ago
2 years ago
DelMsgBySeqList(ctx context.Context, userID string, seqList []uint32) (totalUnExistSeqList []uint32, err error)
2 years ago
// logic delete
DelMsgLogic(ctx context.Context, userID string, seqList []uint32) error
2 years ago
DelMsgBySeqListInOneDoc(ctx context.Context, docID string, seqList []uint32) (unExistSeqList []uint32, err error)
2 years ago
ReplaceMsgToBlankByIndex(docID string, index int) (replaceMaxSeq uint32, err error)
2 years ago
// status
SetSendMsgStatus(ctx context.Context, id string, status int32) error
GetSendMsgStatus(ctx context.Context, id string) (int32, error) // 不存在返回 constant.MsgStatusNotExist
2 years ago
// delete
DelMsgFromCache(ctx context.Context, userID string, seqs []uint32) error
GetGroupMaxSeq(ctx context.Context, groupID string) (uint32, error)
2 years ago
GetGroupMinSeq(ctx context.Context, groupID string) (uint32, error)
2 years ago
SetGroupUserMinSeq(ctx context.Context, groupID string, seq uint32) error
DelUserAllSeq(ctx context.Context, userID string) error // redis and mongodb
2 years ago
GetUserMaxSeq(ctx context.Context, userID string) (uint32, error)
GetUserMinSeq(ctx context.Context, userID string) (uint32, error)
GetMessageListBySeq(ctx context.Context, userID string, seqs []uint32) ([]*sdkws.MsgData, error)
2 years ago
GetSuperGroupMsg(ctx context.Context, groupID string, seq uint32) (*sdkws.MsgData, error)
2 years ago
}
type MsgDatabaseInterface interface {
BatchInsertChat2DB(ctx context.Context, userID string, msgList []*pbMsg.MsgDataToMQ, currentMaxSeq uint64) error
BatchInsertChat2Cache(ctx context.Context, insertID string, msgList []*pbMsg.MsgDataToMQ) (error, uint64)
DelMsgBySeqList(ctx context.Context, userID string, seqList []uint32) (totalUnExistSeqList []uint32, err error)
}