SYNC_INBOX 补 conversation_type、peer_id、group_id 和 last_read_msg_id。历史消息在 sender 为 0 时用 peer_id 定位对方。已读清未读时保留会话 ZSET 分数,避免被毫秒时间戳冲到游标后面。 Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
736 B
Go
33 lines
736 B
Go
// Package entity holds conversation domain types.
|
|
package entity
|
|
|
|
// Type is persisted as conversations.type.
|
|
type Type int
|
|
|
|
const (
|
|
TypeP2P Type = 1
|
|
TypeGroup Type = 2
|
|
)
|
|
|
|
func (t Type) Valid() bool {
|
|
return t == TypeP2P || t == TypeGroup
|
|
}
|
|
|
|
// Conversation is a P2P or group chat. LastMsgID is the Snowflake cursor, not ConversationSeq.
|
|
type Conversation struct {
|
|
ID int64
|
|
Type Type
|
|
LastMsgID int64
|
|
LastMsgAt int64
|
|
}
|
|
|
|
// DialogFace is the viewer-relative identity of one conversation.
|
|
// PeerID is the other member of a P2P chat. GroupID is groups.id, not the conversation id.
|
|
type DialogFace struct {
|
|
ConversationID int64
|
|
Type Type
|
|
PeerID int64
|
|
GroupID int64
|
|
LastReadMsgID int64
|
|
}
|