Documentation ¶
Index ¶
- func InitConnection(uri string) redis.Conn
- type RedisConnection
- func (c *RedisConnection) Del(key string) error
- func (c *RedisConnection) ExecuteTx()
- func (c *RedisConnection) Exists(key string) bool
- func (c *RedisConnection) FlushAll()
- func (c *RedisConnection) GetSortedSet(key string) (map[string]float64, error)
- func (c *RedisConnection) GetValue(key string) (string, error)
- func (c *RedisConnection) IncrBy(key string, value int64) (int64, error)
- func (c *RedisConnection) Keys(pattern string) (res []string, err error)
- func (c *RedisConnection) MGet(keys ...string) (res []string, err error)
- func (c *RedisConnection) Set(key string, value string) error
- func (c *RedisConnection) Sort(key, by string, alpha, desc bool, get ...string) ([][]byte, error)
- func (c *RedisConnection) StartTx()
- func (c *RedisConnection) ZAdd(key string, rank int64, member string) error
- func (c *RedisConnection) ZCount(key string) (int64, error)
- func (c *RedisConnection) ZIncrBy(key string, increment int64, member string) (int64, error)
- func (c *RedisConnection) ZRangeByLex(key, min, max string) ([]string, error)
- func (c *RedisConnection) ZRangeByLexInt(key, min, max string) ([]int64, error)
- func (c *RedisConnection) ZRem(key string, member string) error
- func (c *RedisConnection) ZRevRangeByLex(key, min, max string) ([]string, error)
- func (c *RedisConnection) ZRevRangeByLexInt(key, min, max string) ([]int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitConnection ¶
InitConnection returns a new connection to redis
Types ¶
type RedisConnection ¶
func NewMiniRedisConnection ¶
func NewMiniRedisConnection() *RedisConnection
func NewRedisConnection ¶
func NewRedisConnection(uri string) *RedisConnection
func (*RedisConnection) Del ¶
func (c *RedisConnection) Del(key string) error
Del removes given key from redis Cmd Returns: number of deletions and error Returns: error
func (*RedisConnection) ExecuteTx ¶
func (c *RedisConnection) ExecuteTx()
func (*RedisConnection) Exists ¶
func (c *RedisConnection) Exists(key string) bool
Exists checks if a key exists in redis
func (*RedisConnection) FlushAll ¶
func (c *RedisConnection) FlushAll()
FlushAll flushes all the key in the redis db
func (*RedisConnection) GetSortedSet ¶
func (c *RedisConnection) GetSortedSet(key string) (map[string]float64, error)
GetSortedSet fetches complete sorted set using ZRANGE query. Returns map with value and its rank in set.
func (*RedisConnection) GetValue ¶
func (c *RedisConnection) GetValue(key string) (string, error)
GetValue gets the value saved at a given key
func (*RedisConnection) IncrBy ¶
func (c *RedisConnection) IncrBy(key string, value int64) (int64, error)
IncrBy increment value of a key by passed amount. Returns: currentValue of key
func (*RedisConnection) Keys ¶
func (c *RedisConnection) Keys(pattern string) (res []string, err error)
Keys returns the keys stored in redis with specified pattern
func (*RedisConnection) MGet ¶
func (c *RedisConnection) MGet(keys ...string) (res []string, err error)
MGet returns the value for keys passed
func (*RedisConnection) Set ¶
func (c *RedisConnection) Set(key string, value string) error
Set sets the value of a key to passed key. Cmd Returns: "OK" if successfull and error Returns error if error occured
func (*RedisConnection) StartTx ¶
func (c *RedisConnection) StartTx()
func (*RedisConnection) ZAdd ¶
func (c *RedisConnection) ZAdd(key string, rank int64, member string) error
ZAdd inserts value in sorted set. Cmd Returns: number of insertions and error Returns: error
func (*RedisConnection) ZRangeByLex ¶
func (c *RedisConnection) ZRangeByLex(key, min, max string) ([]string, error)
ZRangeByLex executes ZRANGEBYLEX expecting []string as return
func (*RedisConnection) ZRangeByLexInt ¶
func (c *RedisConnection) ZRangeByLexInt(key, min, max string) ([]int64, error)
ZRangeByLexInt executes ZRANGEBYLEX expecting []int64 as return
func (*RedisConnection) ZRem ¶
func (c *RedisConnection) ZRem(key string, member string) error
ZRem removes value in sorted set. Cmd Returns: number of deletions and error Returns: error
func (*RedisConnection) ZRevRangeByLex ¶
func (c *RedisConnection) ZRevRangeByLex(key, min, max string) ([]string, error)
ZRevRangeByLex executes ZREVRANGEBYLEX expecting []int64 as return
func (*RedisConnection) ZRevRangeByLexInt ¶
func (c *RedisConnection) ZRevRangeByLexInt(key, min, max string) ([]int64, error)
ZRevRangeByLexInt executes ZREVRANGEBYLEX expecting []int64 as return