Documentation
¶
Index ¶
- Constants
- type BigIntType
- type BuildContactParams
- type ChatGroup
- type ChatGroupUser
- type Contact
- type ContactStatus
- type FetchContactRangeParams
- type FetchMsgRangeParams
- type FetchType
- type Message
- type MsgReadStatus
- type MsgStatus
- type PeerAckStatus
- type Robot
- type UpdateLastMsgId
- type UpdateLastMsgIdItem
- type User
Constants ¶
View Source
const ( TotalDb = 10 TotalTableMessage = 100 // message表:分表个数(一共10个数据库,每个数据库100个表) TotalTableContact = 100 // contact表:分表个数(一共10个数据库,每个数据库100个表) )
View Source
const ( ContactStatusNormal = 0 // 正常 ContactStatusDeleted = 1 // 已删除 )
View Source
const TableNameChatGroup = "chat_group"
View Source
const TableNameChatGroupUser = "chat_group_user"
View Source
const TableNameContact = "contact"
View Source
const TableNameMessage = "message"
View Source
const TableNameRobot = "robot"
View Source
const TableNameUser = "user"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildContactParams ¶
type BuildContactParams struct { OwnerId *gen_id.ComponentId PeerId *gen_id.ComponentId }
BuildContactParams 构建参数
type ChatGroup ¶
type ChatGroup struct { ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true;comment:自增id,主键" json:"id"` // 自增id,主键 Type uint32 `gorm:"column:type;not null;comment:群组类型" json:"type"` // 群组类型 Name string `gorm:"column:name;not null;comment:群组名称" json:"name"` // 群组名称 Avatar string `gorm:"column:avatar;not null;comment:群组头像" json:"avatar"` // 群组头像 Notification string `gorm:"column:notification;not null;comment:群组公告" json:"notification"` // 群组公告 OwnerID uint64 `gorm:"column:owner_id;not null;comment:群组拥有者" json:"owner_id"` // 群组拥有者 CreatorID uint64 `gorm:"column:creator_id;not null;comment:群组创建者" json:"creator_id"` // 群组创建者 CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间 }
ChatGroup 群组表
type ChatGroupUser ¶
type ChatGroupUser struct { ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true;comment:自增id,主键" json:"id"` // 自增id,主键 MemberID uint64 `gorm:"column:member_id;not null;comment:群组成员id" json:"member_id"` // 群组成员id GroupID uint64 `gorm:"column:group_id;not null;comment:群组id" json:"group_id"` // 群组id CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间 }
ChatGroupUser 群组与用户的绑定关系
func (*ChatGroupUser) TableName ¶
func (*ChatGroupUser) TableName() string
TableName ChatGroupUser's table name
type Contact ¶
type Contact struct { ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true;comment:自增id,主键" json:"id"` // 自增id,主键 OwnerID uint64 `gorm:"column:owner_id;not null;comment:会话拥有者" json:"owner_id"` // 会话拥有者 OwnerType uint32 `gorm:"column:owner_type;not null;comment:用户类型(owner_id)" json:"owner_type"` // 用户类型(owner_id) PeerID uint64 `gorm:"column:peer_id;not null;comment:联系人(对方用户)" json:"peer_id"` // 联系人(对方用户) PeerType uint32 `gorm:"column:peer_type;not null;comment:用户类型(peer_id)" json:"peer_type"` // 用户类型(peer_id) PeerAck uint32 `gorm:"column:peer_ack;not null;comment:peer_id是否给owner发过消息,0:未发过,1:发过" json:"peer_ack"` // peer_id是否给owner发过消息,0:未发过,1:发过 LastMsgID uint64 `gorm:"column:last_msg_id;not null;comment:聊天记录中,最新一条发送的私信id" json:"last_msg_id"` // 聊天记录中,最新一条发送的私信id LastDelMsgID uint64 `` // 聊天记录中,最后一次删除联系人时的私信id /* 129-byte string literal not displayed */ VersionID uint64 `gorm:"column:version_id;not null;comment:版本id(用于拉取会话框)" json:"version_id"` // 版本id(用于拉取会话框) SortKey uint64 `` // 会话展示顺序(按顺序展示会话)可修改顺序,如:置顶操作 /* 137-byte string literal not displayed */ Status uint32 `gorm:"column:status;not null;comment:联系人状态,0:正常,1:被删除" json:"status"` // 联系人状态,0:正常,1:被删除 Labels string `gorm:"column:labels;not null;comment:会话标签,json字符串" json:"labels"` // 会话标签,json字符串 CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间 }
Contact 会话表(通信双方各有一行记录)
type FetchContactRangeParams ¶
type FetchContactRangeParams struct { FetchType FetchType OwnerId *gen_id.ComponentId PivotVersionId BigIntType Limit int }
FetchContactRangeParams 拉取会话列表
type FetchMsgRangeParams ¶
type FetchMsgRangeParams struct { FetchType FetchType SessionId string LastDelMsgVersionId, PivotVersionId BigIntType // 确定消息的允许获取范围 Limit int OwnerId, PeerId *gen_id.ComponentId }
FetchMsgRangeParams 拉取消息列表
type Message ¶
type Message struct { ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true;comment:自增id" json:"id"` // 自增id MsgID uint64 `gorm:"column:msg_id;not null;comment:消息唯一id(服务端生成)" json:"msg_id"` // 消息唯一id(服务端生成) SeqID uint64 `gorm:"column:seq_id;not null;comment:消息唯一id(客户端生成)" json:"seq_id"` // 消息唯一id(客户端生成) MsgType uint32 `gorm:"column:msg_type;not null;comment:消息类型" json:"msg_type"` // 消息类型 Content string `gorm:"column:content;not null;comment:消息内容,json格式" json:"content"` // 消息内容,json格式 SessionID string `gorm:"column:session_id;not null;comment:会话id" json:"session_id"` // 会话id SenderID uint64 `gorm:"column:sender_id;not null;comment:消息发送者id" json:"sender_id"` // 消息发送者id SenderType uint32 `gorm:"column:sender_type;not null;comment:消息发送者的用户类型" json:"sender_type"` // 消息发送者的用户类型 VersionID uint64 `gorm:"column:version_id;not null;comment:版本id(用于拉取消息)" json:"version_id"` // 版本id(用于拉取消息) SortKey uint64 `gorm:"column:sort_key;not null;comment:消息展示顺序(按顺序展示消息)" json:"sort_key"` // 消息展示顺序(按顺序展示消息) Status uint32 `gorm:"column:status;not null;comment:消息状态" json:"status"` // 消息状态 HasRead uint32 `gorm:"column:has_read;not null;comment:接收方是否已读,0:未读,1:已读" json:"has_read"` // 接收方是否已读,0:未读,1:已读 InvisibleList string `` // 发送方看到消息发出去了,但是对于在列表的用户是不可见的 /* 149-byte string literal not displayed */ CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间 }
Message 消息表(一条私信只有一行记录)
type MsgReadStatus ¶
type MsgReadStatus uint32
MsgReadStatus 消息读取状态
const ( MsgNotRead MsgReadStatus = 0 // 未读 MsgRead = 1 // 已读 )
type PeerAckStatus ¶
type PeerAckStatus uint32
PeerAckStatus 是否给owner发过消息
const ( PeerNotAck PeerAckStatus = 0 // 未发过 PeerAcked = 1 // 发过 )
type Robot ¶
type Robot struct { ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true;comment:自增id,主键" json:"id"` // 自增id,主键 Name string `gorm:"column:name;not null;comment:机器人的名称" json:"name"` // 机器人的名称 CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间 }
Robot 机器人
type UpdateLastMsgId ¶
type UpdateLastMsgId struct { SessionId string LastMsgId uint64 Peer1 UpdateLastMsgIdItem `json:"peer_1"` Peer2 UpdateLastMsgIdItem `json:"peer_2"` }
UpdateLastMsgId 更新最后一条消息
type UpdateLastMsgIdItem ¶
type UpdateLastMsgIdItem struct { ContactId uint64 OwnerId *gen_id.ComponentId }
type User ¶
type User struct { ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true;comment:自增id,主键" json:"id"` // 自增id,主键 Name string `gorm:"column:name;not null;comment:用户" json:"name"` // 用户 Avatar string `gorm:"column:avatar;not null;comment:用户头像" json:"avatar"` // 用户头像 CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间 }
User 用户表
Click to show internal directories.
Click to hide internal directories.