redis

package
v0.0.0-...-5ae7496 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConnection

func InitConnection(uri string) redis.Conn

InitConnection returns a new connection to redis

Types

type RedisConnection

type RedisConnection struct {
	redis.Conn
}

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) Sort

func (c *RedisConnection) Sort(key, by string, alpha, desc bool, get ...string) ([][]byte, error)

Sort executes SORT command. Returns byteslices [][]byte and error

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) ZCount

func (c *RedisConnection) ZCount(key string) (int64, error)

func (*RedisConnection) ZIncrBy

func (c *RedisConnection) ZIncrBy(key string, increment int64, member string) (int64, 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

Jump to

Keyboard shortcuts

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