redis

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NameTryCount = 5
)

Variables

This section is empty.

Functions

func ChangeName

func ChangeName(redisCli *redis.Client, oldName, newName string) error

func GetBasicInfo

func GetBasicInfo(redisCli *redis.Client, uids ...string) (map[string]*pb.ProfileBasic, error)

func GetProfileStatus

func GetProfileStatus(redisCli *redis.Client, profileID ...string) map[string]int32

func IsNameExist

func IsNameExist(redisCli *redis.Client, name string) (bool, error)

func NewNameKey

func NewNameKey() (key.Key, error)

func NewProfileBasicKey

func NewProfileBasicKey(uid string) (key.Key, error)

func NewProfileStatusKey

func NewProfileStatusKey(uid string) (key.Key, error)

func RandomName

func RandomName(redisCli *redis.Client, name string) (string, error)

func SaveName

func SaveName(redisCli *redis.Client, name string) error

SaveName TODO fix Redis String to Hash

func SetBasicInfo

func SetBasicInfo(redisCli *redis.Client, uid string, basic *pb.ProfileBasic) error

func SetProfileStatus

func SetProfileStatus(redisCli *redis.Client, profileID string, status int) error

func UpdateBasicWithProfile

func UpdateBasicWithProfile(redisCli *redis.Client, uid string, profile *pb.Profile) error

Types

type ProfileBasic

type ProfileBasic struct {
	Uid       string `json:"uid"  redis:"uid"`
	Nickname  string `json:"nickname" redis:"nickname"`
	Avatar    string `json:"avatar" redis:"avatar"`
	HeroId    int32  `json:"hero_id" redis:"hero_id" `
	HallUrl   string `json:"hall_url" redis:"hall_url"`
	BattleUrl string `json:"battle_url" redis:"battle_url"`
	RoomId    string `json:"room_id" redis:"room_id"`
}

func (*ProfileBasic) MarshalBinary

func (p *ProfileBasic) MarshalBinary() ([]byte, error)

func (*ProfileBasic) UnmarshalBinary

func (p *ProfileBasic) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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