Documentation ¶
Index ¶
- Constants
- Variables
- func GetDisplayText(contentType int) string
- func GetFakeChannelIDWith(fromUID, toUID string) string
- func GetToChannelIDWithFakeChannelID(fakeChannelID string, uid string) string
- func IsFakeChannel(channelID string) bool
- type AuthCodeType
- type ChannelType
- type ContentType
- type DeviceType
- type GroupAllowViewHistoryMsgStatus
- type GroupMemberRole
- type GroupMemberStatus
- type MemoryCache
- func (m *MemoryCache) Delete(key string) error
- func (m *MemoryCache) Get(key string) (string, error)
- func (m *MemoryCache) LPUSH(key string, values ...interface{}) (int64, error)
- func (m *MemoryCache) LPop(key string) (string, error)
- func (m *MemoryCache) SAdd(key string, members ...interface{}) error
- func (m *MemoryCache) SMembers(key string) ([]string, error)
- func (m *MemoryCache) Set(key string, value string) error
- func (m *MemoryCache) SetAndExpire(key string, value string, expire time.Duration) error
- func (m *MemoryCache) SetExpire(key string, expire time.Duration) ([]string, error)
- type PageResult
- type QRCodeModel
- type QRCodeType
- type RTCCallType
- type RTCResultType
- type RedisCache
- func (r *RedisCache) Delete(key string) error
- func (r *RedisCache) Get(key string) (string, error)
- func (r *RedisCache) GetRedisConn() *redis.Conn
- func (r *RedisCache) LPUSH(key string, values ...interface{}) (int64, error)
- func (r *RedisCache) LPop(key string) (string, error)
- func (r *RedisCache) SAdd(key string, members ...interface{}) error
- func (r *RedisCache) SMembers(key string) ([]string, error)
- func (r *RedisCache) Set(key string, value string) error
- func (r *RedisCache) SetAndExpire(key string, value string, expire time.Duration) error
- func (r *RedisCache) SetExpire(key string, expire time.Duration) error
- type ScanLoginStatus
- type UserStatus
- type VercodeType
Constants ¶
const ( // GroupMemberSeqKey 群成员序列号key GroupMemberSeqKey = "groupMember" // GroupSettingSeqKey 群设置序列号key GroupSettingSeqKey = "groupSetting" // GroupSeqKey 群序列号key GroupSeqKey = "group" // UserSettingSeqKey 用户设置序列号key UserSettingSeqKey = "userSetting" // UserSeqKey 用户序列号 UserSeqKey = "user" // FriendSeqKey 好友 FriendSeqKey = "friend" // MessageExtraSeqKey 消息扩展序号 MessageExtraSeqKey = "messageExtra" // MessageReactionSeqKey 消息回应序号 MessageReactionSeqKey = "messageReaction" // RobotSeqKey 机器人序号 RobotSeqKey = "robot" // RobotEventSeqKey 机器人事件序号 RobotEventSeqKey = "robotEventSeq:" // SensitiveWordsKey 敏感词序号 SensitiveWordsKey = "sensitiveWords" // ReminderKey 提醒项序号 RemindersKey = "reminders" // SyncConversationExtraKey 同步最近会话扩展 SyncConversationExtraKey = "syncConversationExtra" // ProhibitWord 违禁词 ProhibitWordKey = "ProhibitWord" )
const ( // GroupAttrKeyName 群名称 GroupAttrKeyName = "name" // GroupAttrKeyNotice 群公告 GroupAttrKeyNotice = "notice" // GroupAttrKeyForbidden 群禁言 GroupAttrKeyForbidden = "forbidden" // GroupAttrKeyInvite 邀请确认 GroupAttrKeyInvite = "invite" // GroupAttrKeyForbiddenAddFriend 群内禁止加好友 GroupAttrKeyForbiddenAddFriend = "forbidden_add_friend" // GroupAttrKeyStatus 群状态 GroupAttrKeyStatus = "status" // GroupAllowViewHistoryMsg 是否允许新成员查看历史消息 GroupAllowViewHistoryMsg = "allow_view_history_msg" // GroupAllowMemberPinnedMessage 是否允许成员置顶消息 GroupAllowMemberPinnedMessage = "allow_member_pinned_message" )
群属性key
const ( // CMDChannelUpdate 频道信息更新 CMDChannelUpdate = "channelUpdate" // CMDGroupMemberUpdate 群成员更新 CMDGroupMemberUpdate = "memberUpdate" // CMDConversationUnreadClear 未读数清空 CMDConversationUnreadClear = "unreadClear" // CMDGroupAvatarUpdate 群头像更新 CMDGroupAvatarUpdate = "groupAvatarUpdate" // CMDCommunityAvatarUpdate 社区头像更新 CMDCommunityAvatarUpdate = "communityAvatarUpdate" // CMDCommunityCoverUpdate 社区封面更新 CMDCommunityCoverUpdate = "communityCoverUpdate" // CMDConversationDelete 删除最近会话 CMDConversationDelete = "conversationDelete" // CMDFriendRequest 好友申请 CMDFriendRequest = "friendRequest" // friendAccept 接受好友申请 CMDFriendAccept = "friendAccept" // friendDeleted 好友被删除 CMDFriendDeleted = "friendDeleted" // userAvatarUpdate 个人头像更新 CMDUserAvatarUpdate = "userAvatarUpdate" // 输入中 CMDTyping = "typing" // 在线状态 CMDOnlineStatus = "onlineStatus" // 动态点赞或评论消息 CMDMomentMsg = "momentMsg" // 同步消息扩展数据 CMDSyncMessageExtra = "syncMessageExtra" // 同步消息回应数据 CMDSyncMessageReaction = "syncMessageReaction" // 退出pc登录 CMDPCQuit = "pcQuit" // 最近会话被删除 CMDConversationDeleted = "conversationDeleted" // 同步提醒项 CMDSyncReminders = "syncReminders" // 同步最近会话扩展 CMDSyncConversationExtra = "syncConversationExtra" // 组织信息更新 CMDOrganizationInfoUpdate = "organizationInfoUpdate" // 退出某个组织 CMDQuitOrganization = "quitOrganization" // 加入某个组织 CMDJoinOrganization = "joinOrganization" // 同步置顶消息 CMDSyncPinnedMessage = "syncPinnedMessage" // 消息擦除 CMDMessageErase = "messageEerase" // friendDeleted 好友被删除 CMDGroupKick = "wk_group_kick" )
命令消息
const AuthCodeCachePrefix = "authcode:"
AuthCodeCachePrefix 授权code
const QRCodeCachePrefix = "qrcode:"
QRCodeCachePrefix 二维码缓存前缀
const UserDeviceBadgePrefix = "userDeviceBadge"
UserDeviceBadgePrefix 用户设备红点
const UserDeviceTokenPrefix = "userDeviceToken:"
UserDeviceTokenPrefix 用户设备token缓存前缀
Variables ¶
var ErrData = errors.New("数据格式有误!")
ErrData 数据格式有误
Functions ¶
func GetDisplayText ¶
func GetFakeChannelIDWith ¶
GetFakeChannelIDWith GetFakeChannelIDWith
func GetToChannelIDWithFakeChannelID ¶
获取fakeChannelID里的非uid的uid
Types ¶
type AuthCodeType ¶
type AuthCodeType string
AuthCodeType 认证代码类型
const AuthCodeTypeGroupMemberInvite AuthCodeType = "groupMemberInvite"
AuthCodeTypeGroupMemberInvite 群成员邀请
const AuthCodeTypeJoinGroup AuthCodeType = "joinGroup"
AuthCodeTypeJoinGroup 进群授权code
const AuthCodeTypeScanLogin AuthCodeType = "scanLogin"
AuthCodeTypeScanLogin 扫描登录
type ChannelType ¶
type ChannelType uint8
ChannelType 频道类型
const ( // ChannelTypeNone 没有指定频道 ChannelTypeNone ChannelType = iota // ChannelTypePerson 个人频道 ChannelTypePerson // ChannelTypeGroup 群频道 ChannelTypeGroup // ChannelTypeCustomerService 客服频道 ChannelTypeCustomerService // ChannelTypeCommunity 社区 ChannelTypeCommunity // ChannelTypeCommunityTopic 话题 ChannelTypeCommunityTopic // ChannelTypeInfo 资讯类频道 ChannelTypeInfo )
type ContentType ¶
type ContentType int
ContentType 正文类型
const ( // Text 文本消息 Text ContentType = 1 // 文本消息 // Image 图片消息 Image ContentType = 2 // GIF 消息 GIF ContentType = 3 //Voice 语音消息 Voice ContentType = 4 // Video 视频 Video ContentType = 5 // LOCATION 位置 Location ContentType = 6 // Card 名片 Card ContentType = 7 // File 文件 File ContentType = 8 // MultipleForward 合并转发 MultipleForward ContentType = 11 // VectorSticker 矢量表情 VectorSticker ContentType = 12 // EmojiSticker 矢量emoji表情 EmojiSticker ContentType = 13 // RichText 富文本消息 RichText ContentType = 14 // Forward 转发消息 // InviteJoinOrganization 邀请加入组织 InviteJoinOrganization ContentType = 16 // 发送红包的消息 SendRedPacket ContentType = 17 // 消息正文错误 ContentError ContentType = 97 // signal 解密失败 SignalError ContentType = 98 // CMD 消息 CMD ContentType = 99 // ---------- 系统类 ---------- // Tip 只作为提醒无任何操作类型 Tip ContentType = 2000 // FriendApply 好友申请 FriendApply ContentType = 1000 // GroupCreate 群创建 GroupCreate ContentType = 1001 // GroupMemberAdd 群成员添加 GroupMemberAdd ContentType = 1002 // GroupMemberRemove 群成员移除 GroupMemberRemove ContentType = 1003 // FriendSure 好友申请 FriendSure ContentType = 1004 // GroupUpdate 群更新 GroupUpdate ContentType = 1005 // RevokeMessage 撤回消息 RevokeMessage ContentType = 1006 // GroupMemberScanJoin 扫码进群 GroupMemberScanJoin ContentType = 1007 // GroupTransferGrouper 转让群主 GroupTransferGrouper ContentType = 1008 // GroupMemberInvite 群成员邀请 GroupMemberInvite ContentType = 1009 // GroupMemberBeRemove 群成员被移除(被踢) GroupMemberBeRemove ContentType = 1020 // GroupMemberBeRemove 群成员主动退出群聊 GroupMemberQuit ContentType = 1021 // 群升级 GroupUpgrade ContentType = 1022 // 抢红包的消息 RobRedPacket ContentType = 1023 // ---------- 客服类 ---------- HotlineAssignTo ContentType = 1200 // 分配客服 HotlineSolved ContentType = 1201 // 已解决 HotlineReopen ContentType = 1202 // 会话被重开 // ---------- 音视频 ---------- VideoCallResult ContentType = 9989 // 音视频通话结果 )
func (ContentType) String ¶
func (c ContentType) String() string
type DeviceType ¶
type DeviceType string
DeviceType 设备类型
const ( // DeviceTypeIOS iOS设备 DeviceTypeIOS DeviceType = "IOS" // DeviceTypeMI 小米设备 DeviceTypeMI DeviceType = "MI" // DeviceTypeHMS 华为设备 DeviceTypeHMS DeviceType = "HMS" // DeviceTypeFirebase 海外GOOGLE Firebase推送 DeviceTypeFirebase DeviceType = "FIREBASE" // DeviceTypeOPPO oppo设备 DeviceTypeOPPO DeviceType = "OPPO" // DeviceTypeVIVO vivo设备 DeviceTypeVIVO DeviceType = "VIVO" )
type GroupAllowViewHistoryMsgStatus ¶
type GroupAllowViewHistoryMsgStatus int
GroupAllowViewHistoryMsgStatus 新成员是否能查看历史消息
const ( // GroupAllowViewHistoryMsgDisabled 不能查看历史消息 GroupAllowViewHistoryMsgDisabled GroupAllowViewHistoryMsgStatus = 0 // GroupAllowViewHistoryMsgEnabled 能查看历史消息 GroupAllowViewHistoryMsgEnabled GroupAllowViewHistoryMsgStatus = 1 )
type GroupMemberRole ¶
type GroupMemberRole int
GroupMemberRole 群成员角色
const ( // GroupMemberRoleCreater 群主 GroupMemberRoleCreater GroupMemberRole = 1 // GroupMemberRoleManager 管理员 GroupMemberRoleManager GroupMemberRole = 2 // GroupMemberRoleNormal 成员 GroupMemberRoleNormal GroupMemberRole = 0 )
type GroupMemberStatus ¶
type GroupMemberStatus int
GroupMemberStatus 群成员状态
const ( // GroupMemberStatusNormal 正常 GroupMemberStatusNormal GroupMemberStatus = 1 // GroupMemberStatusBlacklist 黑名单 GroupMemberStatusBlacklist GroupMemberStatus = 2 )
type MemoryCache ¶
MemoryCache 内存缓存
func (*MemoryCache) LPUSH ¶ added in v1.1.3
func (m *MemoryCache) LPUSH(key string, values ...interface{}) (int64, error)
func (*MemoryCache) SAdd ¶ added in v1.1.3
func (m *MemoryCache) SAdd(key string, members ...interface{}) error
func (*MemoryCache) SMembers ¶ added in v1.1.3
func (m *MemoryCache) SMembers(key string) ([]string, error)
func (*MemoryCache) SetAndExpire ¶
SetAndExpire SetAndExpire
type PageResult ¶
type PageResult struct { PageIndex int64 `json:"page_index"` // 页码 PageSize int64 `json:"page_size"` // 页大小 Total int64 `json:"total"` // 数据总量 Data interface{} `json:"data"` // 数据 }
PageResult 分页结果
func NewPageResult ¶
func NewPageResult(pageIndex int64, pageSize int64, total int64, data interface{}) *PageResult
NewPageResult NewPageResult
type QRCodeModel ¶
type QRCodeModel struct { Type QRCodeType `json:"type"` // 二维码类型 Data map[string]interface{} `json:"data"` }
QRCodeModel QRCodeModel
func NewQRCodeModel ¶
func NewQRCodeModel(typ QRCodeType, data map[string]interface{}) *QRCodeModel
NewQRCodeModel NewQRCodeModel
type QRCodeType ¶
type QRCodeType string
QRCodeType 二维码类型
const ( // QRCodeTypeGroup 群聊 QRCodeTypeGroup QRCodeType = "group" // QRCodeTypeScanLogin 扫描登录 QRCodeTypeScanLogin QRCodeType = "scanLogin" )
func (QRCodeType) MarshalJSON ¶
func (q QRCodeType) MarshalJSON() ([]byte, error)
MarshalJSON MarshalJSON
func (*QRCodeType) UnmarshalJSON ¶
func (q *QRCodeType) UnmarshalJSON(b []byte) error
UnmarshalJSON UnmarshalJSON
type RTCCallType ¶
type RTCCallType int
const ( RTCCallTypeAudio RTCCallType = 0 // 语音通话 RTCCallTypeVideo RTCCallType = 1 // 视频通话 )
type RTCResultType ¶
type RTCResultType int
const ( RTCResultTypeCancel RTCResultType = 0 // 取消通话 RTCResultTypeHangup RTCResultType = 1 // 挂断通话 RTCResultTypeMissed RTCResultType = 2 // 未接听 RTCResultTypeRefuse RTCResultType = 3 // 拒绝接听 RTCResultTypeBusy RTCResultType = 4 // 忙线中 )
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
RedisCache redis缓存
func (*RedisCache) GetRedisConn ¶
func (r *RedisCache) GetRedisConn() *redis.Conn
GetRedisConn 获取redis连接
func (*RedisCache) LPUSH ¶
func (r *RedisCache) LPUSH(key string, values ...interface{}) (int64, error)
LPUSH 向List添加元素
func (*RedisCache) SAdd ¶
func (r *RedisCache) SAdd(key string, members ...interface{}) error
SAdd 向Set添加元素
func (*RedisCache) SMembers ¶
func (r *RedisCache) SMembers(key string) ([]string, error)
SMembers 获取Set中的所有元素
func (*RedisCache) SetAndExpire ¶
SetAndExpire 包含过期时间
type ScanLoginStatus ¶
type ScanLoginStatus string
ScanLoginStatus 扫码状态
const ( // ScanLoginStatusExpired 二维码过期 ScanLoginStatusExpired ScanLoginStatus = "expired" // ScanLoginStatusWaitScan 等待扫码 ScanLoginStatusWaitScan ScanLoginStatus = "waitScan" // ScanLoginStatusScanned 已扫描 ScanLoginStatusScanned ScanLoginStatus = "scanned" // ScanLoginStatusAuthed 已授权 ScanLoginStatusAuthed ScanLoginStatus = "authed" )
type UserStatus ¶
type UserStatus int
UserStatus 用户状态
const ( // UserAvailable 可用 UserAvailable UserStatus = 1 // UserDisable 禁用 UserDisable UserStatus = 0 )
type VercodeType ¶
type VercodeType int
VercodeType 加好友验证码类型
const ( // User 搜索 User VercodeType = 1 // GroupMember 群成员 GroupMember VercodeType = 2 // QRCode 二维码 QRCode VercodeType = 3 // Friend 好友 Friend VercodeType = 4 // MailList 手机联系人 MailList VercodeType = 5 // InvitationCode 邀请码 InvitationCode VercodeType = 6 )