Versions in this module Expand all Collapse all v1 v1.0.0 Jan 2, 2024 Changes in this version + const CtxKey_caller + const CtxKey_cmddesc + const CtxKey_nolog + var RegExprieTime = 8 + var RegSep string = "&" + func IsNilError(err error) bool + type Config struct + Addr string + DB int + MaxActiveConn int + Passwd string + PoolSize int + SSl int + type Redis struct + func DefaultRedis() *Redis + func InitDefaultRedis(cfg *Config) (*Redis, error) + func NewRedis(cfg *Config) (*Redis, error) + func (r *Redis) CreateRegister(key string, cfg *RegistryInfo) *Register + func (r *Redis) CreateRegisterEx(key string, cfgs []*RegistryInfo) *Register + func (r *Redis) Do(ctx context.Context, cmd string, args ...interface{}) (interface{}, error) + func (r *Redis) Do2(ctx context.Context, cmd string, args ...interface{}) RedisResultBind + func (r *Redis) DoCmdBool(ctx context.Context, cmd string, args ...interface{}) (bool, error) + func (r *Redis) DoCmdByteSlices(ctx context.Context, cmd string, args ...interface{}) ([][]byte, error) + func (r *Redis) DoCmdBytes(ctx context.Context, cmd string, args ...interface{}) ([]byte, error) + func (r *Redis) DoCmdFloat64(ctx context.Context, cmd string, args ...interface{}) (float64, error) + func (r *Redis) DoCmdFloat64s(ctx context.Context, cmd string, args ...interface{}) ([]float64, error) + func (r *Redis) DoCmdInt(ctx context.Context, cmd string, args ...interface{}) (int, error) + func (r *Redis) DoCmdInt64(ctx context.Context, cmd string, args ...interface{}) (int64, error) + func (r *Redis) DoCmdInt64Map(ctx context.Context, cmd string, args ...interface{}) (map[string]int64, error) + func (r *Redis) DoCmdInt64s(ctx context.Context, cmd string, args ...interface{}) ([]int64, error) + func (r *Redis) DoCmdIntMap(ctx context.Context, cmd string, args ...interface{}) (map[string]int, error) + func (r *Redis) DoCmdInts(ctx context.Context, cmd string, args ...interface{}) ([]int, error) + func (r *Redis) DoCmdString(ctx context.Context, cmd string, args ...interface{}) (string, error) + func (r *Redis) DoCmdStringMap(ctx context.Context, cmd string, args ...interface{}) (map[string]string, error) + func (r *Redis) DoCmdStrings(ctx context.Context, cmd string, args ...interface{}) ([]string, error) + func (r *Redis) DoCmdUint64(ctx context.Context, cmd string, args ...interface{}) (uint64, error) + func (r *Redis) DoScript(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) (interface{}, error) + func (r *Redis) DoScript2(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) RedisResultBind + func (r *Redis) DoScriptBool(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) (bool, error) + func (r *Redis) DoScriptByteSlices(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) ([][]byte, error) + func (r *Redis) DoScriptBytes(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) ([]byte, error) + func (r *Redis) DoScriptFloat64(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) (float64, error) + func (r *Redis) DoScriptFloat64s(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) ([]float64, error) + func (r *Redis) DoScriptInt(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) (int, error) + func (r *Redis) DoScriptInt64(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) (int64, error) + func (r *Redis) DoScriptInt64Map(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) (map[string]int64, error) + func (r *Redis) DoScriptInt64s(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) ([]int64, error) + func (r *Redis) DoScriptIntMap(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) (map[string]int, error) + func (r *Redis) DoScriptInts(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) ([]int, error) + func (r *Redis) DoScriptString(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) (string, error) + func (r *Redis) DoScriptStringMap(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) (map[string]string, error) + func (r *Redis) DoScriptStrings(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) ([]string, error) + func (r *Redis) DoScriptUint64(ctx context.Context, script *RedisScript, keysAndArgs ...interface{}) (uint64, error) + func (r *Redis) HMGetObj(ctx context.Context, key string, v interface{}) error + func (r *Redis) HMSetObj(ctx context.Context, key string, v interface{}) error + func (r *Redis) HasKey(ctx context.Context, key string) bool + func (r *Redis) Lock(ctx context.Context, key string, timeout time.Duration) (func(), error) + func (r *Redis) NewPipeline() *RedisPipeline + func (r *Redis) Pool() *redis.Pool + func (r *Redis) ReadServices(ctx context.Context, key string, serverNames []string) ([]*RegistryInfo, error) + func (r *Redis) RegHook(f func(ctx context.Context, cmd *RedisCommond)) + func (r *Redis) TryLock(ctx context.Context, key string, timeout time.Duration) (func(), error) + func (r *Redis) WatchServices(key string, serverNames []string, fun func(infos []*RegistryInfo)) + func (r *Redis) WatchServices2(key string, serverNames []string, fun func(addInfos, delInfos []*RegistryInfo)) + type RedisCommond struct + Args []interface{} + Caller *utils.CallerDesc + Cmd string + CmdDesc string + Elapsed time.Duration + Err error + Reply interface{} + func (c *RedisCommond) Bind(v interface{}) error + func (c *RedisCommond) BindJsonObj(v interface{}) error + func (c *RedisCommond) BindJsonObjSlice(v interface{}) error + func (c *RedisCommond) BindMap(v interface{}) error + func (c *RedisCommond) BindSlice(v interface{}) error + func (c *RedisCommond) CmdString() string + func (c *RedisCommond) ReplyString() string + type RedisPipeline struct + Timeout time.Duration + func (p *RedisPipeline) Cmd(commandName string, args ...interface{}) RedisResultBind + func (p *RedisPipeline) Do(ctx context.Context) error + func (p *RedisPipeline) DoEx(ctx context.Context) ([]*RedisCommond, error) + func (p *RedisPipeline) HMGetObj(key string, v interface{}) error + func (p *RedisPipeline) HMSetObj(key string, v interface{}) bool + type RedisResultBind interface + Bind func(v interface{}) error + BindJsonObj func(v interface{}) error + BindJsonObjSlice func(v interface{}) error + BindMap func(v interface{}) error + BindSlice func(v interface{}) error + type RedisScript struct + func NewScript(keyCount int, src string) *RedisScript + type Register struct + func (r *Register) DeReg() error + func (r *Register) Reg() error + type RegistryInfo struct + RegistryAddr string + RegistryID string + RegistryName string + RegistryPort int + RegistryScheme string + func (r *RegistryInfo) MarshalZerologObject(e *zerolog.Event)