redis

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: MIT Imports: 10 Imported by: 0

README

redis

build-img pkg-img reportcard-img coverage-img

Human-friendly Redis client for Go.

Rationale

TODO

Features

  • Simple API.
  • Dependency-free.
  • ...

Install

Go version 1.14+

go get github.com/cristalhq/redis

Example

TODO

Documentation

See these docs.

License

MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitMap

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

BitMap client for bitmap operations in Redis. See: https://redis.io/commands#bitmap

func NewBitMap

func NewBitMap(name string, client *Client) *BitMap

NewBitMap returns new Redis Bitmap client.

func (*BitMap) BitCount

func (bm *BitMap) BitCount(ctx context.Context, start, end int64) (int64, error)

BitCount TODO See: https://redis.io/commands/bitcount

func (*BitMap) BitCountAll

func (bm *BitMap) BitCountAll(ctx context.Context) (int64, error)

BitCountAll returns the number of set bits in a string. See: https://redis.io/commands/bitcount

func (*BitMap) BitField

func (bm *BitMap) BitField(ctx context.Context) (int64, error)

BitField TODO See: https://redis.io/commands/bitfield

func (*BitMap) BitFieldReadOnly

func (bm *BitMap) BitFieldReadOnly(ctx context.Context, enc string, offset int64) (int64, error)

BitFieldReadOnly TODO See: https://redis.io/commands/bitfield_ro

func (*BitMap) BitOp

func (bm *BitMap) BitOp(ctx context.Context, op BitMapOp, keys ...string) (int64, error)

BitOp TODO See: https://redis.io/commands/bitop

func (*BitMap) BitPos

func (bm *BitMap) BitPos(ctx context.Context, bit int64, pos ...int64) (int64, error)

BitPos TODO See: https://redis.io/commands/bitpos

func (*BitMap) GetBit

func (bm *BitMap) GetBit(ctx context.Context, offset int64) (int64, error)

GetBit TODO See: https://redis.io/commands/getbit

func (*BitMap) SetBit

func (bm *BitMap) SetBit(ctx context.Context, offset int64, value int) (int64, error)

SetBit TODO See: https://redis.io/commands/setbit

type BitMapOp

type BitMapOp string

BitMapOp represents operations for BitOp command in Redis.

const (
	AndOp BitMapOp = "and"
	OrOp  BitMapOp = "or"
	XorOp BitMapOp = "xor"
	NotOp BitMapOp = "not"
)

BitMapOp possible values.

type Client

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

func NewClient

func NewClient(_ context.Context, addr string) (*Client, error)

type Geo

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

Geo represents a Redis GeoHash structure.

func NewGeo

func NewGeo(name string, client *Client) *Geo

NewGeo instantiates a new Geo structure client for Redis.

func (*Geo) Add

func (g *Geo) Add(ctx context.Context, geoLocation ...*GeoLocation) (int64, error)

Add add one or more geospatial items in the geospatial index represented using a sorted set. TODO: XX, NX, CH https://redis.io/commands/geoadd

func (*Geo) Dist

func (g *Geo) Dist(ctx context.Context, member1, member2 string, unit GeoUnit) (float64, error)

Dist returns the distance between two members of a geospatial index.

func (*Geo) Hash

func (g *Geo) Hash(ctx context.Context, members ...string) ([]string, error)

Hash returns members of a geospatial index as standard geohash strings.

func (*Geo) Position

func (g *Geo) Position(ctx context.Context, members ...string) ([]*GeoPos, error)

Position returns longitude and latitude of members of a geospatial index.

func (*Geo) Radius

func (g *Geo) Radius(ctx context.Context, longitude, latitude float64, query GeoRadiusQuery) ([]GeoLocation, error)

Radius query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point.

func (*Geo) RadiusByMember

func (g *Geo) RadiusByMember(ctx context.Context, member string, query GeoRadiusQuery) ([]GeoLocation, error)

RadiusByMember query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member.

func (*Geo) Search

func (g *Geo) Search(ctx context.Context) error

Search ... TODO: https://redis.io/commands/geosearch

func (*Geo) SearchStore

func (g *Geo) SearchStore(ctx context.Context) error

SearchStore ... TODO: https://redis.io/commands/geosearchstore

type GeoLocation

type GeoLocation = interface{} // todo redis.GeoLocation

GeoLocation is used with GeoAdd to add geospatial location.

type GeoPos

type GeoPos = interface{} // todo redis.GeoPos

GeoPos is used with GeoPos to add geospatial position.

type GeoRadiusQuery

type GeoRadiusQuery = interface{} // todo redis.GeoRadiusQuery

GeoRadiusQuery is used with GeoRadius to query geospatial index.

type GeoUnit

type GeoUnit string

GeoUnit ...

const (
	MetersUnit     GeoUnit = "m"
	KilometersUnit GeoUnit = "km"
	MilesUnit      GeoUnit = "mi"
	FeetsUnit      GeoUnit = "ft"
)

GeoUnit consts.

type HashMap

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

HashMap TODO

func NewHashMap

func NewHashMap(name string, client *Client) HashMap

NewHashMap TODO

func (*HashMap) Delete

func (hm *HashMap) Delete(ctx context.Context, fields ...string) (int64, error)

Delete TODO See: https://redis.io/commands/hdel

func (*HashMap) Exists

func (hm *HashMap) Exists(ctx context.Context, field string) (bool, error)

Exists TODO See: https://redis.io/commands/hexists

func (*HashMap) Get

func (hm *HashMap) Get(ctx context.Context, field string) (string, error)

Get returns the value associated with field in the hash. See: https://redis.io/commands/hget

func (*HashMap) GetAll

func (hm *HashMap) GetAll(ctx context.Context) (map[string]string, error)

GetAll TODO See: https://redis.io/commands/hgetall

func (*HashMap) IncBy

func (hm *HashMap) IncBy(ctx context.Context, field string, delta int64) (int64, error)

IncBy TODO See: https://redis.io/commands/hincrby

func (*HashMap) IncByFloat

func (hm *HashMap) IncByFloat(ctx context.Context, field string, delta float64) (float64, error)

IncByFloat TODO See: https://redis.io/commands/hincrbyfloat

func (*HashMap) Keys

func (hm *HashMap) Keys(ctx context.Context) ([]string, error)

Keys returns all field names in the hash. See: https://redis.io/commands/hkeys

func (*HashMap) Len

func (hm *HashMap) Len(ctx context.Context) (int64, error)

Len returns the number of fields contained in the hash. See: https://redis.io/commands/hlen

func (*HashMap) MultiGet

func (hm *HashMap) MultiGet(ctx context.Context, fields ...string) ([]Value, error)

MultiGet returns the values associated with the specified fields in the hash. See: https://redis.io/commands/hmget

func (*HashMap) MultiSet

func (hm *HashMap) MultiSet(ctx context.Context, fields map[string]Value) error

MultiSet the specified fields to their respective values in the hash. This command overwrites any specified fields already existing in the hash.

Deprecation notice: as of Redis version 4.0.0 this command is considered as deprecated. While it is unlikely that it will be completely removed, prefer using `HSET` with multiple field-value pairs in its stead.

See: https://redis.io/commands/hmset

func (*HashMap) RandomField

func (hm *HashMap) RandomField(ctx context.Context, cursor uint64, match string, count int64) (_ []string, _ uint64, _ error)

RandomField TODO See: https://redis.io/commands/hrandfield

func (*HashMap) Scan

func (hm *HashMap) Scan(ctx context.Context, cursor uint64, match string, count int64) ([]string, uint64, error)

Scan TODO See: https://redis.io/commands/hscan

func (*HashMap) Set

func (hm *HashMap) Set(ctx context.Context, field string, value Value) error

Set field in the hash to value. If set does not exist, a new set is created. If field already exists in the hash, it is overwritten. See: https://redis.io/commands/hset

func (*HashMap) SetNotExist

func (hm *HashMap) SetNotExist(ctx context.Context, field string, value Value) (int64, error)

SetNotExist field in the hash to value, only if field does not yet exist. If set does not exist, a new set is created. If field already exists, this operation has no effect. See: https://redis.io/commands/hsetnx

func (*HashMap) Strlen

func (hm *HashMap) Strlen(ctx context.Context, key, field string) (int64, error)

Strlen returns the string length of the value associated with field in the hash. If the key or the field do not exist, 0 is returned. See: https://redis.io/commands/hstrlen

func (*HashMap) Values

func (hm *HashMap) Values(ctx context.Context) ([]string, error)

Values returns all values in the hash. See: https://redis.io/commands/hvals

type HyperLogLog

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

HyperLogLog data structure can be used in order to count unique elements in a set using just a small constant amount of memory, specifically 12k bytes for every HyperLogLog (plus a few bytes for the key itself).

func NewHyperLogLog

func NewHyperLogLog(name string, client *Client) *HyperLogLog

NewHyperLogLog instantiates new Redis HyperLogLog client.

func (*HyperLogLog) Add

func (h *HyperLogLog) Add(ctx context.Context, values ...string) (int64, error)

Add the specified elements to the specified HyperLogLog. See: https://redis.io/commands/pfadd

func (*HyperLogLog) Count

func (h *HyperLogLog) Count(ctx context.Context) (int64, error)

Count return the approximated cardinality of the set. See: https://redis.io/commands/pfcount

func (*HyperLogLog) CountWith

func (h *HyperLogLog) CountWith(ctx context.Context, keys ...string) (int64, error)

CountWith return the approximated cardinality of the sets. See: https://redis.io/commands/pfcount

func (*HyperLogLog) Merge

func (h *HyperLogLog) Merge(ctx context.Context, keys ...string) error

Merge N HyperLogLogs, but with high constant times. See: https://redis.io/commands/pfmerge

func (*HyperLogLog) MergeInto

func (h *HyperLogLog) MergeInto(ctx context.Context, dst string, keys ...string) error

MergeInto N HyperLogLogs, but with high constant times. See: https://redis.io/commands/pfmerge

type List

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

List client for list operations in Redis. See: https://redis.io/commands#list

func NewList

func NewList(name string, client *Client) List

NewList returns new Redis List client.

func (List) BlockingLeftMove

func (list List) BlockingLeftMove(ctx context.Context) error

BlockingLeftMove TODO See: https://redis.io/commands/blmove

func (List) BlockingLeftMultiPop

func (list List) BlockingLeftMultiPop(ctx context.Context) error

BlockingLeftMultiPop TODO See: https://redis.io/commands/blmpop

func (List) BlockingLeftPop

func (list List) BlockingLeftPop(ctx context.Context) error

BlockingLeftPop TODO See: https://redis.io/commands/blpop

func (List) BlockingRightPop

func (list List) BlockingRightPop(ctx context.Context) error

BlockingRightPop TODO See: https://redis.io/commands/brpop

func (List) BlockingRightPopLeftPush

func (list List) BlockingRightPopLeftPush(ctx context.Context) error

BlockingRightPopLeftPush TODO See: https://redis.io/commands/brpoplpush

func (List) Index

func (list List) Index(ctx context.Context, index int64) (string, error)

Index returns the element at index index in the list. See: https://redis.io/commands/lindex

func (List) Insert

func (list List) Insert(ctx context.Context, mode string, pivot, element string) (int64, error)

Insert element in the list either before or after the reference value pivot. See: https://redis.io/commands/linsert

func (List) LeftMove

func (list List) LeftMove(ctx context.Context, destination, from, to string) (string, error)

LeftMove atomically returns and removes the first/last element (head/tail depending on the wherefrom argument) of the list and pushes the element at the first/last element (head/tail depending on the whereto argument) of the list stored at destination. Returns the element being popped and pushed.

See: https://redis.io/commands/lmove

func (List) LeftMultiPop

func (list List) LeftMultiPop(ctx context.Context) error

LeftMultiPop TODO See: https://redis.io/commands/lmpop

func (List) LeftPop

func (list List) LeftPop(ctx context.Context, count int64) ([]string, error)

LeftPop removes and returns the first elements of the list. See: https://redis.io/commands/lpop

func (List) LeftPos

func (list List) LeftPos(ctx context.Context) error

LeftPos TODO See: https://redis.io/commands/lpos

func (List) LeftPush

func (list List) LeftPush(ctx context.Context, elements ...string) (int64, error)

LeftPush insert all the specified values at the head of the list. Returns the length of the list after the push operation.

See: https://redis.io/commands/lpush

func (List) LeftPushX

func (list List) LeftPushX(ctx context.Context, elements ...string) (int64, error)

LeftPushX inserts specified values at the head of the list, only if list already exists. In contrary to LPUSH, no operation will be performed when key does not yet exist. Returns the length of the list after the push operation.

See: https://redis.io/commands/lpushx

func (List) Len

func (list List) Len(ctx context.Context) (int64, error)

Len returns the length of the list. See: https://redis.io/commands/llen

func (List) Name

func (list List) Name() string

Name of the List structure.

func (List) Range

func (list List) Range(ctx context.Context, start, stop int64) ([]string, error)

Range returns the specified elements of the list. See: https://redis.io/commands/lrange

func (List) Remove

func (list List) Remove(ctx context.Context, count int64, element string) (int64, error)

Remove the first count occurrences of elements equal to element from the list. See: https://redis.io/commands/lrem

func (List) RightPop

func (list List) RightPop(ctx context.Context, count int64) ([]string, error)

RightPop removes and returns the last elements of the list. See: https://redis.io/commands/rpop

func (List) RightPopLeftPush

func (list List) RightPopLeftPush(ctx context.Context, destination string) (string, error)

RightPopLeftPush atomically returns and removes the last element (tail) of the list stored and pushes the element at the first element (head) of the list stored at destination. Returns the element being popped and pushed.

See: https://redis.io/commands/rpoplpush

func (List) RightPush

func (list List) RightPush(ctx context.Context, elements ...string) (int64, error)

RightPush insert all the specified values at the tail of the list. Returns the length of the list after the push operation.

See: https://redis.io/commands/rpush

func (List) RightPushX

func (list List) RightPushX(ctx context.Context, elements ...string) (int64, error)

RightPushX inserts specified values at the tail of the list, only if list already exists. In contrary to RPUSH, no operation will be performed when key does not yet exist. Returns the length of the list after the push operation.

See: https://redis.io/commands/rpushx

func (List) Set

func (list List) Set(ctx context.Context, index int64, element string) error

Set the list element at index to element. See: https://redis.io/commands/lset

func (List) Trim

func (list List) Trim(ctx context.Context, start, stop int64) error

Trim an existing list so that it will contain only the specified range of elements specified. See: https://redis.io/commands/ltrim

type PubSub

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

PubSub TODO See: https://redis.io/topics/pubsub

func NewPubSub

func NewPubSub(name string) *PubSub

func (*PubSub) CHANNELS

func (ps *PubSub) CHANNELS(ctx context.Context, pattern string) ([]string, error)

CHANNELS TODO See: https://redis.io/commands/pubsub-channels

func (*PubSub) PSUBSCRIBE

func (ps *PubSub) PSUBSCRIBE(ctx context.Context) error

func (*PubSub) PUBLISH

func (ps *PubSub) PUBLISH(ctx context.Context, msg string) (int64, error)

PUBLISH TODO See: https://redis.io/commands/publish

func (*PubSub) PUBSUB_NUMPAT

func (ps *PubSub) PUBSUB_NUMPAT(ctx context.Context) error

func (*PubSub) PUBSUB_NUMSUB

func (ps *PubSub) PUBSUB_NUMSUB(ctx context.Context) error

func (*PubSub) PUBSUB_SHARDCHANNELS

func (ps *PubSub) PUBSUB_SHARDCHANNELS(ctx context.Context) error

func (*PubSub) PUNSUBSCRIBE

func (ps *PubSub) PUNSUBSCRIBE(ctx context.Context) error

func (*PubSub) SPUBLISH

func (ps *PubSub) SPUBLISH(ctx context.Context) error

func (*PubSub) SSUBSCRIBE

func (ps *PubSub) SSUBSCRIBE(ctx context.Context) error

func (*PubSub) SUBSCRIBE

func (ps *PubSub) SUBSCRIBE(ctx context.Context) error

func (*PubSub) SUNSUBSCRIBE

func (ps *PubSub) SUNSUBSCRIBE(ctx context.Context) error

func (*PubSub) UNSUBSCRIBE

func (ps *PubSub) UNSUBSCRIBE(ctx context.Context) error

type PubSubListener

type PubSubListener struct{}

func (*PubSubListener) PING

func (psl *PubSubListener) PING(ctx context.Context) error

func (*PubSubListener) PSUBSCRIBE

func (psl *PubSubListener) PSUBSCRIBE(ctx context.Context) error

func (*PubSubListener) PUNSUBSCRIBE

func (psl *PubSubListener) PUNSUBSCRIBE(ctx context.Context) error

func (*PubSubListener) QUIT

func (psl *PubSubListener) QUIT(ctx context.Context) error

func (*PubSubListener) RESET

func (psl *PubSubListener) RESET(ctx context.Context) error

func (*PubSubListener) SSUBSCRIBE

func (psl *PubSubListener) SSUBSCRIBE(ctx context.Context) error

func (*PubSubListener) SUBSCRIBE

func (psl *PubSubListener) SUBSCRIBE(ctx context.Context) error

func (*PubSubListener) SUNSUBSCRIBE

func (psl *PubSubListener) SUNSUBSCRIBE(ctx context.Context) error

func (*PubSubListener) UNSUBSCRIBE

func (psl *PubSubListener) UNSUBSCRIBE(ctx context.Context) error

type ReaderPool

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

ReaderPool contains logic of *bufio.Reader reuse with various size.

func NewReaderPool

func NewReaderPool(min, max int) *ReaderPool

NewReaderPool creates new ReaderPool that reuses writers which size is in logarithmic range [min, max].

func (*ReaderPool) Get

func (rp *ReaderPool) Get(r io.Reader, size int) *bufio.Reader

Get returns bufio.Reader whose buffer has at least size bytes.

func (*ReaderPool) Put

func (rp *ReaderPool) Put(br *bufio.Reader)

Put takes ownership of bufio.Reader for further reuse.

type Script

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

func NewScript

func NewScript(name string, client *Client) *Script

func (*Script) DEBUG

func (s *Script) DEBUG(ctx context.Context, mode string) error

func (*Script) EXISTS

func (s *Script) EXISTS(ctx context.Context) error

func (*Script) FLUSH

func (s *Script) FLUSH(ctx context.Context) error

func (*Script) KILL

func (s *Script) KILL(ctx context.Context) error

func (*Script) LOAD

func (s *Script) LOAD(ctx context.Context) error

type Set

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

Set represents a Redis Set structure.

func NewSet

func NewSet(name string, client *Client) Set

NewSet instantiates a new Set structure client for Redis.

func (Set) Add

func (set Set) Add(ctx context.Context, members ...string) (int64, error)

Add one or more members to a set. 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. Returns the number of elements that were added to the set, not including all the elements already present in the set.

See: https://redis.io/commands/sadd

func (Set) Cardinality

func (set Set) Cardinality(ctx context.Context) (int64, error)

Cardinality returns the number of members in a set. See: https://redis.io/commands/scard

func (Set) Diff

func (set Set) Diff(ctx context.Context, keys ...string) ([]string, error)

Diff subtract multiple sets. See: https://redis.io/commands/sdiff

func (Set) DiffStore

func (set Set) DiffStore(ctx context.Context, dst string, keys ...string) (int64, error)

DiffStore subtract multiple sets and store the resulting set in a key. See: https://redis.io/commands/sdiffstore

func (Set) Inter

func (set Set) Inter(ctx context.Context, keys ...string) ([]string, error)

Inter intersect multiple sets. See: https://redis.io/commands/sinter

func (Set) InterStore

func (set Set) InterStore(ctx context.Context, dst string, keys ...string) (int64, error)

InterStore intersect multiple sets and store the resulting set in a key. See: https://redis.io/commands/sinterstore

func (Set) IsMember

func (set Set) IsMember(ctx context.Context, member string) (bool, error)

IsMember returns if member is a member of the set. See: https://redis.io/commands/sismember

func (Set) Members

func (set Set) Members(ctx context.Context) ([]string, error)

Members returns all the members in a set. See: https://redis.io/commands/smembers

func (Set) MoveTo

func (set Set) MoveTo(ctx context.Context, dst, member string) (bool, error)

Move a member from one set to another (dst). See: https://redis.io/commands/smove

func (Set) MultiIsMembers

func (set Set) MultiIsMembers(ctx context.Context, members ...string) ([]bool, error)

MultiIsMembers returns whether each member is a member of the set. See: https://redis.io/commands/smismember

func (Set) Name

func (set Set) Name() string

Name of the Set structure.

func (Set) Pop

func (set Set) Pop(ctx context.Context) (string, error)

Pop removes and returns one random members from a set. See: https://redis.io/commands/spop

func (Set) Pops

func (set Set) Pops(ctx context.Context, count int) ([]string, error)

Pops removes and returns one or multiple random members from a set. See: https://redis.io/commands/spop

func (Set) RandomMember

func (set Set) RandomMember(ctx context.Context) (string, error)

RandomMember gets one random member from a set. See: https://redis.io/commands/srandmember

func (Set) RandomMembers

func (set Set) RandomMembers(ctx context.Context, count int64) ([]string, error)

RandomMembers gets one random member from a set. See: https://redis.io/commands/srandmember

func (Set) Remove

func (set Set) Remove(ctx context.Context, members ...string) (int64, error)

Remove one or more members from a set. See: https://redis.io/commands/srem

func (Set) Scan

func (set Set) Scan(ctx context.Context, cursor uint64, match string, count int64) (_ []string, _ uint64, _ error)

Scan incrementally iterate Set elements. See: https://redis.io/commands/sscan

func (Set) Union

func (set Set) Union(ctx context.Context, keys ...string) ([]string, error)

Union add multiple sets. See: https://redis.io/commands/sunion

func (Set) UnionStore

func (set Set) UnionStore(ctx context.Context, dst string, keys ...string) (int64, error)

UnionStore add multiple sets and store the resulting set in a key. See: https://redis.io/commands/sunionstore

type SortedSet

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

SortedSet ...

func NewSortedSet

func NewSortedSet(name string, client *Client) *SortedSet

NewSortedSet instantiates a new SortedSet structure client for Redis.

func (*SortedSet) Add

func (ss *SortedSet) Add(ctx context.Context, items ...*SortedSetItem) (int64, error)

Add ...

func (*SortedSet) BlockingPopMax

func (ss *SortedSet) BlockingPopMax(ctx context.Context) (*SortedSetWithKey, error)

BlockingPopMax ...

func (*SortedSet) BlockingPopMin

func (ss *SortedSet) BlockingPopMin(ctx context.Context) (*SortedSetWithKey, error)

BlockingPopMin ...

func (*SortedSet) Cardinality

func (ss *SortedSet) Cardinality(ctx context.Context) (int64, error)

Cardinality ...

func (*SortedSet) Count

func (ss *SortedSet) Count(ctx context.Context, min, max string) (int64, error)

Count ...

func (*SortedSet) IncBy

func (ss *SortedSet) IncBy(ctx context.Context, delta float64, member string) (float64, error)

IncBy ...

func (*SortedSet) IntersectionStore

func (ss *SortedSet) IntersectionStore(ctx context.Context, store *SortedSetStore, _ ...string) (int64, error)

IntersectionStore ...

func (*SortedSet) LexCount

func (ss *SortedSet) LexCount(ctx context.Context, min, max string) (int64, error)

LexCount ...

func (*SortedSet) PopMax

func (ss *SortedSet) PopMax(ctx context.Context, count ...int64) ([]SortedSetItem, error)

PopMax ...

func (*SortedSet) PopMin

func (ss *SortedSet) PopMin(ctx context.Context, count ...int64) ([]SortedSetItem, error)

PopMin ...

func (*SortedSet) Range

func (ss *SortedSet) Range(ctx context.Context, start, stop int64) ([]string, error)

Range ...

func (*SortedSet) RangeByLex

func (ss *SortedSet) RangeByLex(ctx context.Context, opt *SortedSetRangeBy) ([]string, error)

RangeByLex ...

func (*SortedSet) RangeByScore

func (ss *SortedSet) RangeByScore(ctx context.Context, opt *SortedSetRangeBy) ([]string, error)

RangeByScore ...

func (*SortedSet) Rank

func (ss *SortedSet) Rank(ctx context.Context, member string) (int64, error)

Rank ...

func (*SortedSet) Remove

func (ss *SortedSet) Remove(ctx context.Context, members ...interface{}) (int64, error)

Remove ...

func (*SortedSet) RemoveRangeByLex

func (ss *SortedSet) RemoveRangeByLex(ctx context.Context, min, max string) (int64, error)

RemoveRangeByLex ...

func (*SortedSet) RemoveRangeByRank

func (ss *SortedSet) RemoveRangeByRank(ctx context.Context, start, stop int64) (int64, error)

RemoveRangeByRank ...

func (*SortedSet) RemoveRangeByScore

func (ss *SortedSet) RemoveRangeByScore(ctx context.Context, min, max string) (int64, error)

RemoveRangeByScore ...

func (*SortedSet) ReverseRange

func (ss *SortedSet) ReverseRange(ctx context.Context, start, stop int64) ([]string, error)

ReverseRange ...

func (*SortedSet) ReverseRangeByLex

func (ss *SortedSet) ReverseRangeByLex(ctx context.Context, opt *SortedSetRangeBy) ([]string, error)

ReverseRangeByLex ...

func (*SortedSet) ReverseRangeByScore

func (ss *SortedSet) ReverseRangeByScore(ctx context.Context, opt *SortedSetRangeBy) ([]string, error)

ReverseRangeByScore ...

func (*SortedSet) ReverseRank

func (ss *SortedSet) ReverseRank(ctx context.Context, member string) (int64, error)

ReverseRank ...

func (*SortedSet) Scan

func (ss *SortedSet) Scan(ctx context.Context, cursor uint64, match string, count int64) ([]string, uint64, error)

Scan ...

func (*SortedSet) Score

func (ss *SortedSet) Score(ctx context.Context, member string) (float64, error)

Score ...

func (*SortedSet) UnionStore

func (ss *SortedSet) UnionStore(ctx context.Context, dest string, store *SortedSetStore, _ ...string) (int64, error)

UnionStore ...

type SortedSetItem

type SortedSetItem = interface{} // redis.Z

SortedSetItem ...

type SortedSetRangeBy

type SortedSetRangeBy = interface{} // redis.ZRangeBy

SortedSetRangeBy ...

type SortedSetStore

type SortedSetStore = interface{} // redis.ZStore

SortedSetStore ...

type SortedSetWithKey

type SortedSetWithKey = interface{} // redis.ZWithKey

SortedSetWithKey ...

type Stream

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

Stream TODO See: https://redis.io/topics/streams-intro

func NewStream

func NewStream(name string, client *Client) *Stream

NewStream instantiates a new Stream structure client for Redis.

func (*Stream) Ack

func (st *Stream) Ack(ctx context.Context, group string, ids ...string) (int64, error)

Ack ... See: https://redis.io/commands/xack

func (*Stream) Add

func (st *Stream) Add(ctx context.Context, values map[string]Value) (string, error)

Add ... See: https://redis.io/commands/xadd

func (*Stream) AutoClaim

func (st *Stream) AutoClaim(ctx context.Context) (next string, msg StreamMessage, _ error)

AutoClaim ... See: https://redis.io/commands/xautoclaim

func (*Stream) Claim

func (st *Stream) Claim(ctx context.Context) ([]StreamMessage, error)

Claim ...

func (*Stream) ClaimIDs

func (st *Stream) ClaimIDs(ctx context.Context) ([]string, error)

Claim ...

func (*Stream) Delete

func (st *Stream) Delete(ctx context.Context, ids ...string) (int64, error)

Delete the specified entries from a stream, and returns the number of entries deleted. See: https://redis.io/commands/xdel

func (*Stream) Get

func (st *Stream) Get(ctx context.Context, id string) (StreamMessage, error)

Get the item by id from stream. This operation is not directly supported by Redis, it is a wrapper for XRANGE. See: https://redis.io/commands/xrange#fetching-single-items

func (*Stream) Group

func (st *Stream) Group(ctx context.Context) (int64, error)

Group ... XGROUP CREATE XGROUP CREATECONSUMER XGROUP DELCONSUMER XGROUP DESTROY XGROUP SETID

func (*Stream) Info

func (st *Stream) Info(ctx context.Context) (int64, error)

Info ... XINFO CONSUMERS XINFO GROUPS XINFO STREAM

func (*Stream) Len

func (st *Stream) Len(ctx context.Context) (int64, error)

Len кeturns the number of entries inside a stream. See: https://redis.io/commands/xlen

func (*Stream) Name

func (st *Stream) Name() string

Name of the Stream structure.

func (*Stream) Pending

func (st *Stream) Pending(ctx context.Context, group string) (*StreamPending, error)

Pending ...

func (*Stream) Range

func (st *Stream) Range(ctx context.Context, start, end string, count int64) ([]StreamMessage, error)

Range ... TODO: add start/end validation

func (*Stream) RangeAll

func (st *Stream) RangeAll(ctx context.Context, start, end string) ([]StreamMessage, error)

Range ...

func (*Stream) Read

func (st *Stream) Read(ctx context.Context) ([]StreamInfo, error)

Read ...

func (*Stream) ReadGroup

func (st *Stream) ReadGroup(ctx context.Context) ([]StreamInfo, error)

ReadGroup ...

func (*Stream) ReverseRange

func (st *Stream) ReverseRange(ctx context.Context, end, start string) ([]StreamMessage, error)

ReverseRange ...

func (*Stream) ReverseRangeAll

func (st *Stream) ReverseRangeAll(ctx context.Context, end, start string) ([]StreamMessage, error)

ReverseRange ... https://redis.io/commands/xrevrange

func (*Stream) Trim

func (st *Stream) Trim(ctx context.Context, maxLen int64) (int64, error)

Trim the stream by evicting older entries (entries with lower IDs) if needed. See: https://redis.io/commands/xtrim

type StreamInfo

type StreamInfo struct {
	Stream   string
	Messages []StreamMessage
}

StreamInfo ...

type StreamMessage

type StreamMessage struct {
	ID     string
	Values map[string]interface{}
}

type StreamPending

type StreamPending struct {
	Count     int64
	Lower     string
	Higher    string
	Consumers map[string]int64
}

StreamPending ...

type Strings

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

func NewStrings

func NewStrings(client *Client) Strings

func (Strings) Get

func (s Strings) Get(ctx context.Context, key string) (string, error)

Get TODO See: https://redis.io/commands/get

func (Strings) Set

func (s Strings) Set(ctx context.Context, key, value string) error

Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type. Any previous time to live associated with the key is discarded on successful SET operation.

See: https://redis.io/commands/set

type Value

type Value = string

Jump to

Keyboard shortcuts

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