Documentation ¶
Index ¶
- Constants
- func IsGroupRelation(ctx context.Context, uid, gid int) bool
- func SetGroupRelation(ctx context.Context, uid, gid int)
- type ClientStorage
- func (c *ClientStorage) Bind(ctx context.Context, channel string, clientId int64, uid int) error
- func (c *ClientStorage) Del(ctx context.Context, channel, fd string) error
- func (c *ClientStorage) GetClientIdFromUid(ctx context.Context, sid, channel, cid string) (int64, error)
- func (c *ClientStorage) GetUidFromClientIds(ctx context.Context, sid, channel, uid string) []int64
- func (c *ClientStorage) IsCurrentServerOnline(ctx context.Context, sid, channel, uid string) bool
- func (c *ClientStorage) IsOnline(ctx context.Context, channel, uid string) bool
- func (c *ClientStorage) Set(ctx context.Context, channel string, fd string, uid int) error
- func (c *ClientStorage) UnBind(ctx context.Context, channel string, clientId int64) error
- type ContactRemark
- func (c *ContactRemark) Exist(ctx context.Context, uid int) bool
- func (c *ContactRemark) Get(ctx context.Context, uid int, fid int) string
- func (c *ContactRemark) MGet(ctx context.Context, uid int, fids []int) (map[int]string, error)
- func (c *ContactRemark) MSet(ctx context.Context, uid int, values map[string]any) error
- func (c *ContactRemark) Set(ctx context.Context, uid int, friendId int, value string) error
- type JwtTokenStorage
- type LastCacheMessage
- type MessageStorage
- func (m *MessageStorage) Get(ctx context.Context, talkType int, sender int, receive int) (*LastCacheMessage, error)
- func (m *MessageStorage) MGet(ctx context.Context, fields []string) ([]*LastCacheMessage, error)
- func (m *MessageStorage) Set(ctx context.Context, talkType int, sender int, receive int, ...) error
- type Relation
- func (r *Relation) BatchDelGroupRelation(ctx context.Context, uids []int, gid int)
- func (r *Relation) DelContactRelation(ctx context.Context, uid, uid2 int)
- func (r *Relation) DelGroupRelation(ctx context.Context, uid, gid int)
- func (r *Relation) IsContactRelation(ctx context.Context, uid, uid2 int) error
- func (r *Relation) SetContactRelation(ctx context.Context, uid, uid2 int)
- type RoomOption
- type RoomStorage
- func (r *RoomStorage) Add(ctx context.Context, opt *RoomOption) error
- func (r *RoomStorage) All(ctx context.Context, opt *RoomOption) []int64
- func (r *RoomStorage) BatchAdd(ctx context.Context, opts []*RoomOption) error
- func (r *RoomStorage) BatchDel(ctx context.Context, opts []*RoomOption) error
- func (r *RoomStorage) Del(ctx context.Context, opt *RoomOption) error
- type Sequence
- func (s *Sequence) BatchGet(ctx context.Context, userId int, receiverId int, num int64) []int64
- func (s *Sequence) Get(ctx context.Context, userId int, receiverId int) int64
- func (s *Sequence) Name(userId int, receiverId int) string
- func (s *Sequence) Redis() *redis.Client
- func (s *Sequence) Set(ctx context.Context, userId int, receiverId int, value int) error
- type ServerStorage
- func (s *ServerStorage) All(ctx context.Context, status int) []string
- func (s *ServerStorage) Del(ctx context.Context, server string) error
- func (s *ServerStorage) DelExpireServer(ctx context.Context, server string) error
- func (s *ServerStorage) GetExpireServerAll(ctx context.Context) []string
- func (s *ServerStorage) Redis() *redis.Client
- func (s *ServerStorage) Set(ctx context.Context, server string, time int64) error
- func (s *ServerStorage) SetExpireServer(ctx context.Context, server string) error
- type UnreadStorage
- func (u *UnreadStorage) All(ctx context.Context, receive int) map[string]int
- func (u *UnreadStorage) Del(ctx context.Context, mode, sender, receive int)
- func (u *UnreadStorage) Get(ctx context.Context, mode, sender, receive int) int
- func (u *UnreadStorage) Incr(ctx context.Context, mode, sender, receive int)
- func (u *UnreadStorage) PipeIncr(ctx context.Context, pipe redis.Pipeliner, mode, sender, receive int)
- func (u *UnreadStorage) Reset(ctx context.Context, mode, sender, receive int)
- type Vote
- func (t *Vote) GetVoteAnswerUser(ctx context.Context, voteId string) ([]int, error)
- func (t *Vote) GetVoteStatistics(ctx context.Context, vid string) (string, error)
- func (t *Vote) SetVoteAnswerUser(ctx context.Context, vid string, uids []int) error
- func (t *Vote) SetVoteStatistics(ctx context.Context, vid, value string) error
Constants ¶
const ( // ServerKey 正在的运行服务 ServerKey = "server_ids" // ServerKeyExpire 过期的运行服务 ServerKeyExpire = "server_ids_expire" // ServerOverTime 运行检测超时时间(单位秒) ServerOverTime = 50 )
const ( VoteUsersCache = "talk:vote:answer-users:%s" VoteStatisticCache = "talk:vote:statistic:%s" )
Variables ¶
This section is empty.
Functions ¶
func SetGroupRelation ¶
Types ¶
type ClientStorage ¶
type ClientStorage struct {
// contains filtered or unexported fields
}
func NewClientStorage ¶
func NewClientStorage(redis *redis.Client, config *config.Config, storage *ServerStorage) *ClientStorage
func (*ClientStorage) Del ¶
func (c *ClientStorage) Del(ctx context.Context, channel, fd string) error
Del 删除客户端与用户绑定关系 @params channel 渠道分组 @params fd 客户端连接ID
func (*ClientStorage) GetClientIdFromUid ¶
func (c *ClientStorage) GetClientIdFromUid(ctx context.Context, sid, channel, cid string) (int64, error)
GetClientIdFromUid 获取客户端ID关联的用户ID @params sid 服务节点ID @params channel 渠道分组 @params cid 客户端ID
func (*ClientStorage) GetUidFromClientIds ¶
func (c *ClientStorage) GetUidFromClientIds(ctx context.Context, sid, channel, uid string) []int64
GetUidFromClientIds 获取当前节点用户ID关联的客户端ID @params sid 服务ID @params channel 渠道分组 @params uid 用户ID
func (*ClientStorage) IsCurrentServerOnline ¶
func (c *ClientStorage) IsCurrentServerOnline(ctx context.Context, sid, channel, uid string) bool
IsCurrentServerOnline 判断当前节点是否在线 @params sid 服务ID @params channel 渠道分组 @params uid 用户ID
func (*ClientStorage) IsOnline ¶
func (c *ClientStorage) IsOnline(ctx context.Context, channel, uid string) bool
IsOnline 判断客户端是否在线[所有部署机器] @params channel 渠道分组 @params uid 用户ID
type ContactRemark ¶
type ContactRemark struct {
// contains filtered or unexported fields
}
ContactRemark 好友备注缓存
func NewContactRemark ¶
func NewContactRemark(redis *redis.Client) *ContactRemark
type JwtTokenStorage ¶
type JwtTokenStorage struct {
// contains filtered or unexported fields
}
func NewTokenSessionStorage ¶
func NewTokenSessionStorage(redis *redis.Client) *JwtTokenStorage
func (*JwtTokenStorage) IsBlackList ¶
func (s *JwtTokenStorage) IsBlackList(ctx context.Context, token string) bool
func (*JwtTokenStorage) SetBlackList ¶
type LastCacheMessage ¶
type MessageStorage ¶
type MessageStorage struct {
// contains filtered or unexported fields
}
func NewMessageStorage ¶
func NewMessageStorage(rds *redis.Client) *MessageStorage
func (*MessageStorage) Get ¶
func (m *MessageStorage) Get(ctx context.Context, talkType int, sender int, receive int) (*LastCacheMessage, error)
func (*MessageStorage) MGet ¶
func (m *MessageStorage) MGet(ctx context.Context, fields []string) ([]*LastCacheMessage, error)
func (*MessageStorage) Set ¶
func (m *MessageStorage) Set(ctx context.Context, talkType int, sender int, receive int, message *LastCacheMessage) error
type Relation ¶
type Relation struct {
// contains filtered or unexported fields
}
func NewRelation ¶
func NewRelation(redis *redis.Client) *Relation
func (*Relation) BatchDelGroupRelation ¶
func (*Relation) DelContactRelation ¶
func (*Relation) DelGroupRelation ¶
func (*Relation) IsContactRelation ¶
type RoomOption ¶
type RoomStorage ¶
type RoomStorage struct {
// contains filtered or unexported fields
}
func NewRoomStorage ¶
func NewRoomStorage(redis *redis.Client) *RoomStorage
func (*RoomStorage) Add ¶
func (r *RoomStorage) Add(ctx context.Context, opt *RoomOption) error
Add 添加房间成员
func (*RoomStorage) All ¶
func (r *RoomStorage) All(ctx context.Context, opt *RoomOption) []int64
All 获取所有房间成员
func (*RoomStorage) BatchAdd ¶
func (r *RoomStorage) BatchAdd(ctx context.Context, opts []*RoomOption) error
func (*RoomStorage) BatchDel ¶
func (r *RoomStorage) BatchDel(ctx context.Context, opts []*RoomOption) error
func (*RoomStorage) Del ¶
func (r *RoomStorage) Del(ctx context.Context, opt *RoomOption) error
Del 删除房间成员
type Sequence ¶
type Sequence struct {
// contains filtered or unexported fields
}
func NewSequence ¶
func NewSequence(redis *redis.Client) *Sequence
type ServerStorage ¶
type ServerStorage struct {
// contains filtered or unexported fields
}
func NewSidStorage ¶
func NewSidStorage(rds *redis.Client) *ServerStorage
func (*ServerStorage) All ¶
func (s *ServerStorage) All(ctx context.Context, status int) []string
All 获取指定状态的运行 ServerStorage status 状态[1:运行中;2:已超时;3:全部]
func (*ServerStorage) Del ¶
func (s *ServerStorage) Del(ctx context.Context, server string) error
Del 删除指定 ServerStorage
func (*ServerStorage) DelExpireServer ¶
func (s *ServerStorage) DelExpireServer(ctx context.Context, server string) error
func (*ServerStorage) GetExpireServerAll ¶
func (s *ServerStorage) GetExpireServerAll(ctx context.Context) []string
func (*ServerStorage) Redis ¶
func (s *ServerStorage) Redis() *redis.Client
func (*ServerStorage) SetExpireServer ¶
func (s *ServerStorage) SetExpireServer(ctx context.Context, server string) error
type UnreadStorage ¶
type UnreadStorage struct {
// contains filtered or unexported fields
}
func NewUnreadStorage ¶
func NewUnreadStorage(rds *redis.Client) *UnreadStorage
func (*UnreadStorage) Del ¶
func (u *UnreadStorage) Del(ctx context.Context, mode, sender, receive int)
Del 删除消息未读数 @params mode 对话模式 1私信 2群聊 @params sender 发送者ID @params receive 接收者ID
func (*UnreadStorage) Get ¶
func (u *UnreadStorage) Get(ctx context.Context, mode, sender, receive int) int
Get 获取消息未读数 @params mode 对话模式 1私信 2群聊 @params sender 发送者ID @params receive 接收者ID
func (*UnreadStorage) Incr ¶
func (u *UnreadStorage) Incr(ctx context.Context, mode, sender, receive int)
Incr 消息未读数自增 @params mode 对话模式 1私信 2群聊 @params sender 发送者ID @params receive 接收者ID
type Vote ¶
type Vote struct {
// contains filtered or unexported fields
}