Documentation ¶
Index ¶
- type BaseEntity
- type CommunityEntity
- type Message
- type Node
- type NodeGroup
- type OfflineGroup
- type RelationEntity
- func (relation RelationEntity) AddFriend() int
- func (relation RelationEntity) Delete(id string) int
- func (relation RelationEntity) Insert() int
- func (relation RelationEntity) RemoveFriend() int
- func (relation RelationEntity) SelectBy(query any, role int) (RelationEntity, int)
- func (relation RelationEntity) SelectListBy(query any, role int) ([]RelationEntity, int)
- func (RelationEntity) TableName() string
- func (relation RelationEntity) Update(query any, args ...any) int
- type UserEntity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseEntity ¶
type CommunityEntity ¶
type CommunityEntity struct { BaseEntity CommunityId string `gorm:"type:varchar(32);not null;INDEX" json:"communityId" binding:"required,min=6,max=12" label:"群id"` Name string `gorm:"type:varchar(32);not null" json:"Name" binding:"required,min=1,max=12" label:"群名称"` OwnerId string `gorm:"type:varchar(32);not null" json:"ownerId" binding:"required" label:"群主id"` Face string `gorm:"type:varchar(100);not null" json:"face" label:"群头像"` Memo string `gorm:"type:varchar(100);" json:"memo" label:"群描述"` Extend string `gorm:"-" json:"extend"` }
func (CommunityEntity) SelectBy ¶
func (community CommunityEntity) SelectBy(query any) (CommunityEntity, int)
SelectBy 查单条
func (CommunityEntity) TableName ¶
func (CommunityEntity) TableName() string
type Message ¶
type Message struct { // 消息id Id string `json:"id"` // 发送者id SenderId string `json:"senderId"` // 接受者id ReceiverId string `json:"receiverId"` // 消息内容 Content string `json:"content"` // 附加信息 Extra string `json:"extra"` // 消息类型 前端用来判断 后端不处理 ContentType int `json:"contentType"` // 处理类型 见status ProcessType int `json:"processType"` // 发送时间 SendTime string `json:"sendTime"` // 源数据 Resource []byte `json:"resource"` }
传输消息结构
type Node ¶
type Node struct { // websocket连接 Conn *websocket.Conn // 数据存储队列 DataQueue chan []byte // 群id的set GroupSets set.Interface }
一个用户对应一个node
type NodeGroup ¶
全局node存储 {key:uid value:node}
func (*NodeGroup) SendGroupMessage ¶
SendGroupMessage 发送群消息
func (*NodeGroup) SendMessage ¶
SendMessage 发送消息
type OfflineGroup ¶
离线消息存储
type RelationEntity ¶
type RelationEntity struct { BaseEntity UserId string `gorm:"type:varchar(32);not null" json:"userId" binding:"required,min=6,max=15" label:"用户id"` FriendId string `gorm:"type:varchar(32);not null" json:"friendId" binding:"required,min=6,max=15" label:"好友id"` RelationType int `gorm:"type:int;DEFAULT:1" json:"relationType" binding:"required" label:"关系类型"` RoleType int `gorm:"type:int;DEFAULT:1" json:"roleType" binding:"required" label:"角色类型"` Memo string `gorm:"type:varchar(120);DEFAULT:NULL" json:"memo" label:"描述"` Extend string `gorm:"-" json:"extend"` FriendInfo UserEntity `gorm:"foreignKey:UserId;references:UserId;" json:"friendInfo"` ProposerInfo UserEntity `gorm:"foreignKey:UserId;references:FriendId;" json:"proposerInfo"` CommunityInfo CommunityEntity `gorm:"foreignKey:CommunityId;references:FriendId;" json:"communityInfo"` }
func (RelationEntity) RemoveFriend ¶
func (relation RelationEntity) RemoveFriend() int
RemoveFriend 删除好友
func (RelationEntity) SelectBy ¶
func (relation RelationEntity) SelectBy(query any, role int) (RelationEntity, int)
SelectBy 查单条
func (RelationEntity) SelectListBy ¶
func (relation RelationEntity) SelectListBy(query any, role int) ([]RelationEntity, int)
SelectListBy 查多条
func (RelationEntity) TableName ¶
func (RelationEntity) TableName() string
type UserEntity ¶
type UserEntity struct { BaseEntity NickName string `gorm:"type:varchar(32);not null;INDEX" json:"nickName" binding:"required,min=1,max=12" label:"昵称"` UserId string `gorm:"type:varchar(32);not null " json:"userId" binding:"required,min=6,max=15" label:"用户id"` Password string `gorm:"type:varchar(100);not null " json:"password" binding:"required,min=6,max=15" label:"密码"` UserRole int `gorm:"type:int;DEFAULT:1" json:"userRole" binding:"required" label:"角色类型"` Gender int `gorm:"type:int;DEFAULT:1" json:"gender" label:"性别"` Signature string `gorm:"type:varchar(255) " json:"signature" label:"个人签名"` Mobile string `gorm:"type:varchar(16) " json:"mobile" label:"电话"` Face string `gorm:"type:varchar(255) " json:"face" label:"头像"` }
func (UserEntity) SelectBy ¶
func (user UserEntity) SelectBy(query any) (UserEntity, int)
SelectBy 查单条
func (UserEntity) TableName ¶
func (UserEntity) TableName() string
Click to show internal directories.
Click to hide internal directories.