Documentation ¶
Index ¶
- Variables
- func Bool(reply interface{}, err error) (bool, error)
- func Bytes(reply interface{}, err error) ([]byte, error)
- func Float64(reply interface{}, err error) (float64, error)
- func Int(reply interface{}, err error) (int, error)
- func Int64(reply interface{}, err error) (int64, error)
- func Int64Map(reply interface{}, err error) (map[string]int64, error)
- func Scan(src []interface{}, dest ...interface{}) ([]interface{}, error)
- func ScanSlice(src []interface{}, dest interface{}, fieldNames ...string) error
- func ScanStruct(src []interface{}, dest interface{}) error
- func String(reply interface{}, err error) (string, error)
- func Strings(reply interface{}, err error) ([]string, error)
- func Uint32(reply interface{}, err error) (uint32, error)
- func Uint64(reply interface{}, err error) (uint64, error)
- func Values(reply interface{}, err error) ([]interface{}, error)
- type BasePool
- type ItemScore
- type RedisPool
- func (rp *RedisPool) Del(db int, key interface{}) error
- func (rp *RedisPool) Exists(db int, key interface{}) (bool, error)
- func (rp *RedisPool) Expire(db, expire int, key interface{}) (e error)
- func (rp *RedisPool) ExpireAt(db int, expire int64, key interface{}) (e error)
- func (rp *RedisPool) Get(db int, key interface{}) (value interface{}, e error)
- func (rp *RedisPool) GetReadConnection(db int) redis.Conn
- func (rp *RedisPool) GetWriteConnection(db int) redis.Conn
- func (rp *RedisPool) HDel(db int, args ...interface{}) (e error)
- func (rp *RedisPool) HGet(db int, key interface{}, name interface{}) (value interface{}, e error)
- func (rp *RedisPool) HGetAll(db int, key interface{}) (reply interface{}, e error)
- func (rp *RedisPool) HMGet(db int, values interface{}, key interface{}, ids ...interface{}) (e error)
- func (rp *RedisPool) HMSet(db int, args ...interface{}) (e error)
- func (rp *RedisPool) HMultiGet(db int, args ...interface{}) (values map[interface{}]map[interface{}]interface{}, e error)
- func (rp *RedisPool) HMultiSet(db int, args ...interface{}) (e error)
- func (rp *RedisPool) HSet(db int, key interface{}, id interface{}, value interface{}) (e error)
- func (rp *RedisPool) Incr(db int, key interface{}) (uint64, error)
- func (rp *RedisPool) IncrBy(db int, key interface{}, value interface{}) (uint64, error)
- func (rp *RedisPool) Keys(db int) (keys []interface{}, e error)
- func (rp *RedisPool) LLen(db int, key interface{}) (length int, e error)
- func (rp *RedisPool) LPop(db int, key interface{}) (value interface{}, e error)
- func (rp *RedisPool) LRange(db int, key interface{}, start, stop interface{}) (value interface{}, e error)
- func (rp *RedisPool) Lock(db int, key_suffix string, expire_sec int64, timeout int64) (getLock bool)
- func (rp *RedisPool) MGet(db int, keys ...interface{}) (value interface{}, e error)
- func (rp *RedisPool) MHGetAll(db int, args ...interface{}) (reply map[interface{}][]interface{}, e error)
- func (rp *RedisPool) MSet(db int, kvs ...interface{}) (value interface{}, e error)
- func (rp *RedisPool) Multi(db int, cmd func(con redigo.Conn) error) error
- func (rp *RedisPool) MultiExpire(db, expire int, args ...interface{}) (e error)
- func (rp *RedisPool) RPush(db int, key interface{}, values ...interface{}) (value interface{}, e error)
- func (rp *RedisPool) SAdd(db int, key interface{}, values ...interface{}) (e error)
- func (rp *RedisPool) SCard(db int, key interface{}) (num uint64, e error)
- func (rp *RedisPool) SIsMember(db int, key interface{}, value interface{}) (isMember bool, e error)
- func (rp *RedisPool) SMembers(db int, values interface{}, key interface{}) (e error)
- func (rp *RedisPool) SMultiAdd(db int, args ...interface{}) error
- func (rp *RedisPool) SMultiRem(db int, args ...interface{}) error
- func (rp *RedisPool) SRem(db int, key interface{}, values ...interface{}) (e error)
- func (rp *RedisPool) Set(db int, key interface{}, value interface{}) (e error)
- func (rp *RedisPool) SetEx(db int, key interface{}, seconds int, value interface{}) (e error)
- func (rp *RedisPool) SetNX(db int, key interface{}, value interface{}) (int, error)
- func (rp *RedisPool) TTL(db int, key interface{}) (int64, error)
- func (rp *RedisPool) UnLock(db int, key_suffix string) (e error)
- func (rp *RedisPool) ZAdd(db int, args ...interface{}) error
- func (rp *RedisPool) ZAddOpt(db int, opt string, args ...interface{}) error
- func (rp *RedisPool) ZCard(db int, key interface{}) (num uint64, e error)
- func (rp *RedisPool) ZCount(db int, key interface{}, min, max float64) (count uint32, e error)
- func (rp *RedisPool) ZExists(db int, key interface{}, id interface{}) (bool, error)
- func (rp *RedisPool) ZIsMember(db int, key interface{}, item interface{}) (isMember bool, e error)
- func (rp *RedisPool) ZMultiIsMember(db int, key interface{}, items map[interface{}]bool) error
- func (rp *RedisPool) ZMultiScore(db int, key interface{}, items ...interface{}) (scores map[interface{}]int64, e error)
- func (rp *RedisPool) ZREVRangeByScoreWithScores(db int, key interface{}, min, max int64, ps int) (items []ItemScore, e error)
- func (rp *RedisPool) ZREVRangeWithScores(db int, key interface{}, start, end int) (items []ItemScore, total int, e error)
- func (rp *RedisPool) ZREVRangeWithScoresPS(db int, key interface{}, cur int, ps int) (items []ItemScore, total int, e error)
- func (rp *RedisPool) ZRange(db int, key interface{}, start, end int, asc bool, results interface{}) (total int, e error)
- func (rp *RedisPool) ZRangeByScore(db int, key interface{}, min, max interface{}) (items []ItemScore, e error)
- func (rp *RedisPool) ZRangeByScoreWithScores(db int, key interface{}, min, max int64, ps int) (items []ItemScore, e error)
- func (rp *RedisPool) ZRangePS(db int, key interface{}, cur int, ps int, asc bool, results interface{}) (total int, e error)
- func (rp *RedisPool) ZRangeWithScores(db int, key interface{}, start, end int) (items []ItemScore, total int, e error)
- func (rp *RedisPool) ZRangeWithScoresPS(db int, key interface{}, cur int, ps int) (items []ItemScore, total int, e error)
- func (rp *RedisPool) ZRem(db int, args ...interface{}) (affected []int, e error)
- func (rp *RedisPool) ZRemRangeByScore(db int, key interface{}, min, max int64) error
- func (rp *RedisPool) ZScore(db int, key interface{}, item interface{}) (score int64, e error)
- func (rp *RedisPool) ZUnionSrore(db int, dest_key interface{}, expire int, keys []interface{}, ...) error
Constants ¶
This section is empty.
Variables ¶
var ErrNil = redis.ErrNil
Functions ¶
func ScanStruct ¶
func ScanStruct(src []interface{}, dest interface{}) error
Types ¶
type RedisPool ¶
type RedisPool struct {
// contains filtered or unexported fields
}
func (*RedisPool) HMGet ¶
func (rp *RedisPool) HMGet(db int, values interface{}, key interface{}, ids ...interface{}) (e error)
HMGet针对同一个key获取hashset中的部分元素的值
参数:
args: 第一个值必须是key,后续的值都是id values: 必须是数组的引用,如果某个id不存在,会把对应数据类型的零值放在数组对应位置上
func (*RedisPool) HMultiGet ¶
func (rp *RedisPool) HMultiGet(db int, args ...interface{}) (values map[interface{}]map[interface{}]interface{}, e error)
HMultiGet批量获取HashSet中多个key中ID的值
参数:
db: 数据库表ID args: 必须是<key,id>的列表
返回值:
values: 一个两层的map,第一层的key是参数中的key,第二层的key是参数中的id
func (*RedisPool) LRange ¶
func (rp *RedisPool) LRange(db int, key interface{}, start, stop interface{}) (value interface{}, e error)
获取队列数据
func (*RedisPool) MHGetAll ¶
func (rp *RedisPool) MHGetAll(db int, args ...interface{}) (reply map[interface{}][]interface{}, e error)
MHGetAll批量获取多个key所有的字段
func (*RedisPool) RPush ¶
func (rp *RedisPool) RPush(db int, key interface{}, values ...interface{}) (value interface{}, e error)
批量插入队尾
func (*RedisPool) ZAddOpt ¶
批量添加到sorted set类型的表中
db: 数据库表ID opt: 可选参数,必须是NX|XX|CH|INCR|""中的一个 args: 必须是<key,score,id>的列表
func (*RedisPool) ZMultiIsMember ¶
批量判断是否是有序集合中的元素
func (*RedisPool) ZMultiScore ¶
func (rp *RedisPool) ZMultiScore(db int, key interface{}, items ...interface{}) (scores map[interface{}]int64, e error)
批量获取有序集合的元素的得分
func (*RedisPool) ZREVRangeByScoreWithScores ¶
func (rp *RedisPool) ZREVRangeByScoreWithScores(db int, key interface{}, min, max int64, ps int) (items []ItemScore, e error)
根据score 获取有序集 ZREVRANGEBYSCORE min <=score < max 按照score 从大到小排序, ps 获取条数
func (*RedisPool) ZREVRangeWithScores ¶
func (*RedisPool) ZREVRangeWithScoresPS ¶
func (*RedisPool) ZRange ¶
func (rp *RedisPool) ZRange(db int, key interface{}, start, end int, asc bool, results interface{}) (total int, e error)
获取SortedSet的ID集合
func (*RedisPool) ZRangeByScore ¶
func (*RedisPool) ZRangeByScoreWithScores ¶
func (rp *RedisPool) ZRangeByScoreWithScores(db int, key interface{}, min, max int64, ps int) (items []ItemScore, e error)
根据score 获取有序集 ZRANGEBYSCORE min <score <= max 按照score 从小到大排序, ps 获取条数
func (*RedisPool) ZRangePS ¶
func (rp *RedisPool) ZRangePS(db int, key interface{}, cur int, ps int, asc bool, results interface{}) (total int, e error)
分页获取SortedSet的ID集合
func (*RedisPool) ZRangeWithScores ¶
func (*RedisPool) ZRangeWithScoresPS ¶
func (*RedisPool) ZRem ¶
ZRem批量删除sorted set表中的元素
参数:
db: 数据库表ID args: 必须是<key,id>的列表
返回值:
affected: 每条命令影响的行数
func (*RedisPool) ZRemRangeByScore ¶
移除有序集 key 中,所有 score 值介于 min 和 max 之间(包括等于 min 或 max )的成员
func (*RedisPool) ZUnionSrore ¶
func (rp *RedisPool) ZUnionSrore(db int, dest_key interface{}, expire int, keys []interface{}, weights []interface{}, aggregate string) error
合并多个有序集合,其中权重weights 默认为1 ,AGGREGATE 默认使用sum ZUNIONSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] dest_key:合并目标key keys: 带合并的keys集合 <key> 的列表 expire: 有效时间 (秒值) aggregate: 聚合方式: SUM | MIN | MAX