seahorse

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2019 License: MIT Imports: 2 Imported by: 0

README

Seahorse

Seahorse is a Redis client and Redis Queue manger.

Installation

go get -u github.com/Kamva/seahorse
Supported Commands
  • String Types (key-value types)
    • APPEND
    • BITCOUNT
    • DECR
    • DECRBY
    • GET
    • GETRANGE
    • GETSET
    • INCR
    • INCRBY
    • INCRBYFLOAT
    • MGET
    • MSET
    • SET
    • SETRANGE
    • STRLEN
  • Lists
    • BLPOP
    • BRPOP
    • BRPOPLPUSH
    • LINDEX
    • LINSERT
    • LLEN
    • LPOP
    • LPUSH
    • LRANGE
    • LREM
    • LSET
    • LTRIM
    • RPOP
    • RPOPLPUSH
    • RPUSH
  • Sets
    • SADD
    • SCARD
    • SDIFF
    • SDIFFSTORE
    • SINTER
    • SINTERSTORE
    • SISMEMBER
    • SMEMBERS
    • SMOVE
    • SPOP
    • SRANDMEMBER
    • SREM
    • SUNION
    • SUNIONSTORE
  • Hashes
    • HDEL
    • HEXISTS
    • HGET
    • HGETALL
    • HINCRBY
    • HINCRBYFLOAT
    • HKEYS
    • HLEN
    • HMGET
    • HMSET
    • HSET
    • HSTRLEN
    • HVALS
  • General
    • DEL
    • DUMP
    • EXISTS
    • EXPIRE
    • EVAL
    • EXPIREAT
    • FLUSHALL
    • KEYS
    • PERSIST
    • PEXPIRE
    • PEXPIREAT
    • PTTL
    • RANDOMKEY
    • RENAME
    • SCAN
    • SORT
    • TTL
    • TYPE
    • UNLINK

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List struct {
	// contains filtered or unexported fields
}

List redis wrapper for list operations

func (List) Index

func (l List) Index(index int) (interface{}, error)

Index Returns the element at index index in the list stored at key. The index is zero-based, so 0 means the first element, 1 the second element and so on. Negative indices can be used to designate elements starting at the tail of the list. Here, -1 means the last element, -2 means the penultimate and so forth.

When the value at key is not a list, an error is returned.

func (List) LeftPop

func (l List) LeftPop() (interface{}, error)

LeftPop Removes and returns the first element of the list stored at key.

func (List) LeftPush

func (l List) LeftPush(value interface{}) (int, error)

LeftPush Insert all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned.

func (List) Length

func (l List) Length() (int, error)

Length Returns the length of the list stored at key. If key does not exist, it is interpreted as an empty list and 0 is returned. An error is returned when the value stored at key is not a list.

func (List) Range

func (l List) Range(start int, end int) ([]interface{}, error)

Range Returns the specified elements of the list stored at key. The offsets start and stop are zero-based indexes, with 0 being the first element of the list (the head of the list), 1 being the next element and so on.

func (List) Remove

func (l List) Remove(value interface{}, occurrences int) (int, error)

Remove Removes the first count occurrences of elements equal to value from the list stored at key. The count argument influences the operation in the following ways:

count > 0: Remove elements equal to value moving from head to tail.
count < 0: Remove elements equal to value moving from tail to head.
count = 0: Remove all elements equal to value.

func (List) RightPop

func (l List) RightPop() (interface{}, error)

RightPop Removes and returns the last element of the list stored at key.

func (List) RightPopLeftPush

func (l List) RightPopLeftPush(newKey string) (interface{}, error)

RightPopLeftPush Atomically returns and removes the last element (tail) of the list stored at source, and pushes the element at the first element (head) of the list stored at destination.

func (List) RightPush

func (l List) RightPush(value interface{}) (int, error)

RightPush Insert all the specified values at the tail of the list stored at key. If key does not exist, it is created as empty list before performing the push operation. When key holds a value that is not a list, an error is returned.

func (List) Set

func (l List) Set(index int, value interface{}) (bool, error)

Set Sets the list element at index to value.

type Redis

type Redis struct {
	// contains filtered or unexported fields
}

Redis is a wrapper for redigo redis client

func NewRedis

func NewRedis(url string) *Redis

NewRedis initiate the redis object and returns it

func (Redis) Exists

func (r Redis) Exists(key string) (bool, error)

Exists checks for `key` exists in the redis database

func (Redis) FlushAll

func (r Redis) FlushAll() error

FlushAll flushes all keys in the redis

func (Redis) Get

func (r Redis) Get(key string) (string, error)

Get returns the value that has been set for `key`

func (Redis) Lists

func (r Redis) Lists(key string) *List

Lists returns a wrapper to do all the operation of a list.

func (Redis) Set

func (r Redis) Set(key string, value string) (bool, error)

Set creates a key-value and set the `value` for `key` and returns true if successfully created the key-value

func (Redis) Sets

func (r Redis) Sets(key string) *Set

Sets returns a wrapper to do all the operation of a set.

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set redis wrapper for set operations

func (Set) Add

func (s Set) Add(value interface{}) (bool, error)

Add the specified members to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.

func (Set) Cardinality

func (s Set) Cardinality() (int, error)

Cardinality Returns the set cardinality (number of elements) of the set stored at key.

func (Set) Diff

func (s Set) Diff(key2 string) ([]interface{}, error)

Diff Returns the members of the set resulting from the difference between the first set and all the successive sets.

func (Set) IsMember

func (s Set) IsMember(value interface{}) (bool, error)

IsMember Returns if member is a member of the set stored at key.

func (Set) Members

func (s Set) Members() ([]interface{}, error)

Members Returns all the members of the set value stored at key.

func (Set) Move

func (s Set) Move(otherKey string, value interface{}) (bool, error)

Move Move member from the set at source to the set at destination. This operation is atomic. In every given moment the element will appear to be a member of source or destination for other clients.

func (Set) Pop

func (s Set) Pop() (interface{}, error)

Pop Removes and returns one random elements from the set value store at key.

func (Set) PopMany

func (s Set) PopMany(quantity int) ([]interface{}, error)

PopMany Removes and returns specified random elements from the set value store at key.

func (Set) Remove

func (s Set) Remove(value interface{}) (int, error)

Remove Remove the specified members from the set stored at key. Specified members that are not a member of this set are ignored. If key does not exist, it is treated as an empty set and this command returns 0.

Jump to

Keyboard shortcuts

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