messages

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarkMessagesRead

func MarkMessagesRead(convId, readerId uint64)

func SaveOrCreateById

func SaveOrCreateById(entity *Entity) int64

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 Get

func Get(id any) (entity Entity)

func GetByConvId

func GetByConvId(convId uint64, offset, limit int) []Entity

func (*Entity) TableName

func (itself *Entity) TableName() string

Jump to

Keyboard shortcuts

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