clients

package
v5.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoRedis

type GoRedis struct {
	Conn *goredis.Client // import goredis "github.com/go-redis/redis/v8"
	// contains filtered or unexported fields
}

GoRedis implements ReJSON interface for Go-Redis/Redis Redis client Link: https://github.com/go-redis/redis

func NewGoRedisClient

func NewGoRedisClient(ctx context.Context, conn *goredis.Client) *GoRedis

NewGoRedisClient returns a new GoRedis ReJSON client with the provided context and connection, if ctx is nil default context.Background will be used

func (*GoRedis) JSONArrAppend

func (r *GoRedis) JSONArrAppend(key, path string, values ...interface{}) (res interface{}, err error)

JSONArrAppend to append json value into array at path

ReJSON syntax:

JSON.ARRAPPEND <key> <path> <json> [json ...]

func (*GoRedis) JSONArrIndex

func (r *GoRedis) JSONArrIndex(key, path string, jsonValue interface{}, optionalRange ...int) (res interface{}, err error)

JSONArrIndex returns the index of the json element provided and return -1 if element is not present

ReJSON syntax:

JSON.ARRINDEX <key> <path> <json-scalar> [start [stop]]

func (*GoRedis) JSONArrInsert

func (r *GoRedis) JSONArrInsert(key, path string, index int, values ...interface{}) (res interface{}, err error)

JSONArrInsert inserts the json value(s) into the array at path before the index (shifts to the right).

ReJSON syntax:

JSON.ARRINSERT <key> <path> <index> <json> [json ...]

func (*GoRedis) JSONArrLen

func (r *GoRedis) JSONArrLen(key, path string) (res interface{}, err error)

JSONArrLen returns the length of the json array at path

ReJSON syntax:

JSON.ARRLEN <key> [path]

func (*GoRedis) JSONArrPop

func (r *GoRedis) JSONArrPop(key, path string, index int) (res interface{}, err error)

JSONArrPop removes and returns element from the index in the array to pop last element use rejson.PopArrLast

ReJSON syntax:

JSON.ARRPOP <key> [path [index]]

func (*GoRedis) JSONArrTrim

func (r *GoRedis) JSONArrTrim(key, path string, start, end int) (res interface{}, err error)

JSONArrTrim trims an array so that it contains only the specified inclusive range of elements

ReJSON syntax:

JSON.ARRTRIM <key> <path> <start> <stop>

func (*GoRedis) JSONDebug

func (r *GoRedis) JSONDebug(subcommand rjs.DebugSubCommand, key, path string) (res interface{}, err error)

JSONDebug reports information

ReJSON syntax:

JSON.DEBUG <subcommand & arguments>
	JSON.DEBUG MEMORY <key> [path]	- report the memory usage in bytes of a value. path defaults to root if not provided.
	JSON.DEBUG HELP					- reply with a helpful message

func (*GoRedis) JSONDel

func (r *GoRedis) JSONDel(key string, path string) (res interface{}, err error)

JSONDel to delete a json object

ReJSON syntax:

JSON.DEL <key> <path>

func (*GoRedis) JSONForget

func (r *GoRedis) JSONForget(key, path string) (res interface{}, err error)

JSONForget is an alias for JSONDel

ReJSON syntax:

JSON.FORGET <key> [path]

func (*GoRedis) JSONGet

func (r *GoRedis) JSONGet(key, path string, opts ...rjs.GetOption) (res interface{}, err error)

JSONGet used to get a json object

ReJSON syntax:

JSON.GET <key>
		[INDENT indentation-string]
		[NEWLINE line-break-string]
		[SPACE space-string]
		[NOESCAPE]
		[path ...]

func (*GoRedis) JSONMGet

func (r *GoRedis) JSONMGet(path string, keys ...string) (res interface{}, err error)

JSONMGet used to get path values from multiple keys

ReJSON syntax:

JSON.MGET <key> [key ...] <path>

func (*GoRedis) JSONNumIncrBy

func (r *GoRedis) JSONNumIncrBy(key, path string, number int) (res interface{}, err error)

JSONNumIncrBy to increment a number by provided amount

ReJSON syntax:

JSON.NUMINCRBY <key> <path> <number>

func (*GoRedis) JSONNumMultBy

func (r *GoRedis) JSONNumMultBy(key, path string, number int) (res interface{}, err error)

JSONNumMultBy to increment a number by provided amount

ReJSON syntax:

JSON.NUMMULTBY <key> <path> <number>

func (*GoRedis) JSONObjKeys

func (r *GoRedis) JSONObjKeys(key, path string) (res interface{}, err error)

JSONObjKeys returns the keys in the object that's referenced by path

ReJSON syntax:

JSON.OBJKEYS <key> [path]

func (*GoRedis) JSONObjLen

func (r *GoRedis) JSONObjLen(key, path string) (res interface{}, err error)

JSONObjLen report the number of keys in the JSON Object at path in key

ReJSON syntax:

JSON.OBJLEN <key> [path]

func (*GoRedis) JSONResp

func (r *GoRedis) JSONResp(key, path string) (res interface{}, err error)

JSONResp returns the JSON in key in Redis Serialization Protocol (RESP).

ReJSON syntax:

JSON.RESP <key> [path]

func (*GoRedis) JSONSet

func (r *GoRedis) JSONSet(key string, path string, obj interface{}, opts ...rjs.SetOption) (res interface{}, err error)

JSONSet used to set a json object

ReJSON syntax:

JSON.SET <key> <path> <json>
		 [NX | XX]

func (*GoRedis) JSONStrAppend

func (r *GoRedis) JSONStrAppend(key, path, jsonstring string) (res interface{}, err error)

JSONStrAppend to append a jsonstring to an existing member

ReJSON syntax:

JSON.STRAPPEND <key> [path] <json-string>

func (*GoRedis) JSONStrLen

func (r *GoRedis) JSONStrLen(key, path string) (res interface{}, err error)

JSONStrLen to return the length of a string member

ReJSON syntax:

JSON.STRLEN <key> [path]

func (*GoRedis) JSONType

func (r *GoRedis) JSONType(key, path string) (res interface{}, err error)

JSONType to get the type of key or member at path.

ReJSON syntax:

JSON.TYPE <key> [path]

type Redigo

type Redigo struct {
	Conn redigo.Conn // import redigo "github.com/gomodule/redigo"
}

Redigo implements ReJSON interface for GoModule/Redigo Redis client Link: https://github.com/gomodule/redigo

func (*Redigo) JSONArrAppend

func (r *Redigo) JSONArrAppend(key, path string, values ...interface{}) (res interface{}, err error)

JSONArrAppend used to append json value into array at path

ReJSON syntax:

JSON.ARRAPPEND <key> <path> <json> [json ...]

func (*Redigo) JSONArrIndex

func (r *Redigo) JSONArrIndex(key, path string, jsonValue interface{}, optionalRange ...int) (res interface{}, err error)

JSONArrIndex returns the index of the json element provided and return -1 if element is not present

ReJSON syntax:

JSON.ARRINDEX <key> <path> <json-scalar> [start [stop]]

func (*Redigo) JSONArrInsert

func (r *Redigo) JSONArrInsert(key, path string, index int, values ...interface{}) (res interface{}, err error)

JSONArrInsert inserts the json value(s) into the array at path before the index (shifts to the right).

ReJSON syntax:

JSON.ARRINSERT <key> <path> <index> <json> [json ...]

func (*Redigo) JSONArrLen

func (r *Redigo) JSONArrLen(key, path string) (res interface{}, err error)

JSONArrLen returns the length of the json array at path

ReJSON syntax:

JSON.ARRLEN <key> [path]

func (*Redigo) JSONArrPop

func (r *Redigo) JSONArrPop(key, path string, index int) (res interface{}, err error)

JSONArrPop removes and returns element from the index in the array to pop last element use rejson.PopArrLast

ReJSON syntax:

JSON.ARRPOP <key> [path [index]]

func (*Redigo) JSONArrTrim

func (r *Redigo) JSONArrTrim(key, path string, start, end int) (res interface{}, err error)

JSONArrTrim trims an array so that it contains only the specified inclusive range of elements

ReJSON syntax:

JSON.ARRTRIM <key> <path> <start> <stop>

func (*Redigo) JSONDebug

func (r *Redigo) JSONDebug(subcommand rjs.DebugSubCommand, key, path string) (res interface{}, err error)

JSONDebug reports information

ReJSON syntax:

JSON.DEBUG <subcommand & arguments>
	JSON.DEBUG MEMORY <key> [path]	- report the memory usage in bytes of a value. path defaults to root if not provided.
	JSON.DEBUG HELP					- reply with a helpful message

func (*Redigo) JSONDel

func (r *Redigo) JSONDel(key string, path string) (res interface{}, err error)

JSONDel used to delete a json object

ReJSON syntax:

JSON.DEL <key> <path>

func (*Redigo) JSONForget

func (r *Redigo) JSONForget(key, path string) (res interface{}, err error)

JSONForget is an alias for JSONDel

ReJSON syntax:

JSON.FORGET <key> [path]

func (*Redigo) JSONGet

func (r *Redigo) JSONGet(key, path string, opts ...rjs.GetOption) (res interface{}, err error)

JSONGet used to get a json object

ReJSON syntax:

JSON.GET <key>
		[INDENT indentation-string]
		[NEWLINE line-break-string]
		[SPACE space-string]
		[NOESCAPE]
		[path ...]

func (*Redigo) JSONMGet

func (r *Redigo) JSONMGet(path string, keys ...string) (res interface{}, err error)

JSONMGet used to get path values from multiple keys

ReJSON syntax:

JSON.MGET <key> [key ...] <path>

func (*Redigo) JSONNumIncrBy

func (r *Redigo) JSONNumIncrBy(key, path string, number int) (res interface{}, err error)

JSONNumIncrBy used to increment a number by provided amount

ReJSON syntax:

JSON.NUMINCRBY <key> <path> <number>

func (*Redigo) JSONNumMultBy

func (r *Redigo) JSONNumMultBy(key, path string, number int) (res interface{}, err error)

JSONNumMultBy to multiply a number by provided amount

ReJSON syntax:

JSON.NUMMULTBY <key> <path> <number>

func (*Redigo) JSONObjKeys

func (r *Redigo) JSONObjKeys(key, path string) (res interface{}, err error)

JSONObjKeys returns the keys in the object that's referenced by path

ReJSON syntax:

JSON.OBJKEYS <key> [path]

func (*Redigo) JSONObjLen

func (r *Redigo) JSONObjLen(key, path string) (res interface{}, err error)

JSONObjLen report the number of keys in the JSON Object at path in key

ReJSON syntax:

JSON.OBJLEN <key> [path]

func (*Redigo) JSONResp

func (r *Redigo) JSONResp(key, path string) (res interface{}, err error)

JSONResp returns the JSON in key in Redis Serialization Protocol (RESP).

ReJSON syntax:

JSON.RESP <key> [path]

func (*Redigo) JSONSet

func (r *Redigo) JSONSet(key string, path string, obj interface{}, opts ...rjs.SetOption) (res interface{}, err error)

JSONSet used to set a json object

ReJSON syntax:

JSON.SET <key> <path> <json>
		 [NX | XX]

func (*Redigo) JSONStrAppend

func (r *Redigo) JSONStrAppend(key, path, jsonstring string) (res interface{}, err error)

JSONStrAppend used to append a jsonstring to an existing member

ReJSON syntax:

JSON.STRAPPEND <key> [path] <json-string>

func (*Redigo) JSONStrLen

func (r *Redigo) JSONStrLen(key, path string) (res interface{}, err error)

JSONStrLen used to return the length of a string member

ReJSON syntax:

JSON.STRLEN <key> [path]

func (*Redigo) JSONType

func (r *Redigo) JSONType(key, path string) (res interface{}, err error)

JSONType used to get the type of key or member at path.

ReJSON syntax:

JSON.TYPE <key> [path]

Jump to

Keyboard shortcuts

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