Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarkMessagesRead ¶
func MarkMessagesRead(convId, readerId uint64)
func SaveOrCreateById ¶
Types ¶
type Entity ¶
type Entity struct {
Id uint64 `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"` // 主键
ConvId uint64 `gorm:"column:conv_id;type:bigint unsigned;not null;default:0;index:idx_conv_time,priority:1" json:"convId"` // 所属对话ID
SenderId uint64 `gorm:"column:sender_id;type:bigint unsigned;not null;default:0;" json:"senderId"` // 发送者ID
Content string `gorm:"column:content;type:text;not null;" json:"content"` // 消息文本
MsgType int8 `gorm:"column:msg_type;type:tinyint;not null;default:1;" json:"msgType"` // 消息类型: 1文本, 2图片, 3语音等
IsRead int `gorm:"column:is_read;type:tinyint(1);not null;default:0;" json:"isRead"` // 该消息是否被对方读取
CreatedAt time.Time `gorm:"column:created_at;index;autoCreateTime;<-:create;index:idx_conv_time,priority:2" json:"createdAt"` //
}
func GetByConvId ¶
Click to show internal directories.
Click to hide internal directories.