Documentation ¶
Index ¶
- func JsonArrAppend(processor RedisProcessor, key string, path string, args ...interface{}) *redis.IntCmd
- func JsonArrIndex(processor RedisProcessor, key string, path string, value interface{}, ...) *redis.IntCmd
- func JsonArrInsert(processor RedisProcessor, key string, path string, index int, ...) *redis.IntCmd
- func JsonArrLen(processor RedisProcessor, key string, path string) *redis.IntCmd
- func JsonArrPop(processor RedisProcessor, key string, path string, index int) *redis.StringCmd
- func JsonArrTrim(processor RedisProcessor, key string, path string, start int, stop int) *redis.IntCmd
- func JsonDel(processor RedisProcessor, key string, args ...interface{}) *redis.IntCmd
- func JsonGet(processor RedisProcessor, key string, args ...interface{}) *redis.StringCmd
- func JsonMGet(processor RedisProcessor, key string, args ...interface{}) *redis.StringSliceCmd
- func JsonNumIncrBy(processor RedisProcessor, key string, path string, value int) *redis.StringCmd
- func JsonNumMultBy(processor RedisProcessor, key string, path string, value int) *redis.StringCmd
- func JsonObjKeys(processor RedisProcessor, key string, path string) *redis.StringSliceCmd
- func JsonObjLen(processor RedisProcessor, key string, path string) *redis.IntCmd
- func JsonSet(processor RedisProcessor, key string, path string, json string, ...) *redis.StatusCmd
- func JsonStrAppend(processor RedisProcessor, key string, path string, value string) *redis.IntCmd
- func JsonStrLen(processor RedisProcessor, key string, path string) *redis.IntCmd
- func JsonType(processor RedisProcessor, key string, path string) *redis.StringCmd
- type Client
- func (processor *Client) JsonArrAppend(key string, path string, args ...interface{}) *redis.IntCmd
- func (processor *Client) JsonArrIndex(key string, path string, value interface{}, startAndStop ...interface{}) *redis.IntCmd
- func (processor *Client) JsonArrInsert(key string, path string, index int, values ...interface{}) *redis.IntCmd
- func (processor *Client) JsonArrLen(key string, path string) *redis.IntCmd
- func (processor *Client) JsonArrPop(key string, path string, index int) *redis.StringCmd
- func (processor *Client) JsonArrTrim(key string, path string, start int, stop int) *redis.IntCmd
- func (processor *Client) JsonDel(key string, args ...interface{}) *redis.IntCmd
- func (processor *Client) JsonGet(key string, args ...interface{}) *redis.StringCmd
- func (processor *Client) JsonMGet(key string, args ...interface{}) *redis.StringSliceCmd
- func (processor *Client) JsonNumIncrBy(key string, path string, value int) *redis.StringCmd
- func (processor *Client) JsonNumMultBy(key string, path string, value int) *redis.StringCmd
- func (processor *Client) JsonObjKeys(key string, path string) *redis.StringSliceCmd
- func (processor *Client) JsonObjLen(key string, path string) *redis.IntCmd
- func (processor *Client) JsonSet(key string, path string, json string, args ...interface{}) *redis.StatusCmd
- func (processor *Client) JsonStrAppend(key string, path string, value string) *redis.IntCmd
- func (processor *Client) JsonStrLen(key string, path string) *redis.IntCmd
- func (processor *Client) JsonType(key string, path string) *redis.StringCmd
- func (cl *Client) Pipeline() *Pipeline
- func (cl *Client) TXPipeline() *Pipeline
- type Pipeline
- func (processor *Pipeline) JsonArrAppend(key string, path string, args ...interface{}) *redis.IntCmd
- func (processor *Pipeline) JsonArrIndex(key string, path string, value interface{}, startAndStop ...interface{}) *redis.IntCmd
- func (processor *Pipeline) JsonArrInsert(key string, path string, index int, values ...interface{}) *redis.IntCmd
- func (processor *Pipeline) JsonArrLen(key string, path string) *redis.IntCmd
- func (processor *Pipeline) JsonArrPop(key string, path string, index int) *redis.StringCmd
- func (processor *Pipeline) JsonArrTrim(key string, path string, start int, stop int) *redis.IntCmd
- func (processor *Pipeline) JsonDel(key string, args ...interface{}) *redis.IntCmd
- func (processor *Pipeline) JsonGet(key string, args ...interface{}) *redis.StringCmd
- func (processor *Pipeline) JsonMGet(key string, args ...interface{}) *redis.StringSliceCmd
- func (processor *Pipeline) JsonNumIncrBy(key string, path string, value int) *redis.StringCmd
- func (processor *Pipeline) JsonNumMultBy(key string, path string, value int) *redis.StringCmd
- func (processor *Pipeline) JsonObjKeys(key string, path string) *redis.StringSliceCmd
- func (processor *Pipeline) JsonObjLen(key string, path string) *redis.IntCmd
- func (processor *Pipeline) JsonSet(key string, path string, json string, args ...interface{}) *redis.StatusCmd
- func (processor *Pipeline) JsonStrAppend(key string, path string, value string) *redis.IntCmd
- func (processor *Pipeline) JsonStrLen(key string, path string) *redis.IntCmd
- func (processor *Pipeline) JsonType(key string, path string) *redis.StringCmd
- func (pl *Pipeline) Pipeline() *Pipeline
- type RedisProcessor
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JsonArrAppend ¶ added in v1.0.0
func JsonArrAppend(processor RedisProcessor, key string, path string, args ...interface{}) *redis.IntCmd
---- JsonArrAppend ----
func JsonArrIndex ¶ added in v1.0.0
func JsonArrIndex(processor RedisProcessor, key string, path string, value interface{}, startAndStop ...interface{}) *redis.IntCmd
---- JsonArrIndex ----
func JsonArrInsert ¶ added in v1.0.0
func JsonArrInsert(processor RedisProcessor, key string, path string, index int, values ...interface{}) *redis.IntCmd
---- JsonArrInsert ----
func JsonArrLen ¶ added in v1.0.0
func JsonArrLen(processor RedisProcessor, key string, path string) *redis.IntCmd
---- JsonArrLen ----
func JsonArrPop ¶ added in v1.0.0
---- JsonArrPop ----
func JsonArrTrim ¶ added in v1.0.0
func JsonArrTrim(processor RedisProcessor, key string, path string, start int, stop int) *redis.IntCmd
---- JsonArrTrim ----
func JsonDel ¶ added in v1.0.0
func JsonDel(processor RedisProcessor, key string, args ...interface{}) *redis.IntCmd
---- JsonDel ----
func JsonGet ¶ added in v1.0.0
func JsonGet(processor RedisProcessor, key string, args ...interface{}) *redis.StringCmd
---- JsonGet ----
func JsonMGet ¶ added in v1.0.0
func JsonMGet(processor RedisProcessor, key string, args ...interface{}) *redis.StringSliceCmd
---- JsonMGet ----
func JsonNumIncrBy ¶ added in v1.0.0
---- JsonNumIncrBy ----
func JsonNumMultBy ¶ added in v1.0.0
---- JsonNumMultBy ----
func JsonObjKeys ¶ added in v1.0.0
func JsonObjKeys(processor RedisProcessor, key string, path string) *redis.StringSliceCmd
---- JsonObjKeys ----
func JsonObjLen ¶ added in v1.0.0
func JsonObjLen(processor RedisProcessor, key string, path string) *redis.IntCmd
---- JsonObjLen ----
func JsonSet ¶ added in v1.0.0
func JsonSet(processor RedisProcessor, key string, path string, json string, args ...interface{}) *redis.StatusCmd
---- JsonSet ----
func JsonStrAppend ¶ added in v1.0.0
---- JsonStrAppend ----
func JsonStrLen ¶ added in v1.0.0
func JsonStrLen(processor RedisProcessor, key string, path string) *redis.IntCmd
---- JsonStrLen ----
Types ¶
type Client ¶
Client is an extended redis.Client, stores a pointer to the original redis.Client
func ExtendClient ¶
Example ¶
package main import ( "encoding/json" "fmt" "github.com/KromDaniel/rejonson" "github.com/go-redis/redis" "time" ) func main() { goRedisClient := redis.NewClient(&redis.Options{ Addr: "localhost:6379", }) client := rejonson.ExtendClient(goRedisClient) defer client.Close() arr := []interface{}{"hello", "world", 1, map[string]interface{}{"key": 12}} js, err := json.Marshal(arr) if err != nil { // handle } // redis "native" command client.Set("go-redis-cmd", "hello", time.Second) client.JsonSet("rejson-cmd", ".", string(js)) // int command arrLen, err := client.JsonArrLen("rejson-cmd", ".").Result() if err != nil { // handle } fmt.Printf("Array length: %d", arrLen) }
Output: Array length: 4
func (*Client) JsonArrAppend ¶
func (*Client) JsonArrIndex ¶
func (*Client) JsonArrInsert ¶
func (*Client) JsonArrLen ¶
func (*Client) JsonArrPop ¶
func (*Client) JsonArrTrim ¶
func (*Client) JsonMGet ¶
func (processor *Client) JsonMGet(key string, args ...interface{}) *redis.StringSliceCmd
func (*Client) JsonNumIncrBy ¶
func (*Client) JsonNumMultBy ¶
func (*Client) JsonObjKeys ¶
func (processor *Client) JsonObjKeys(key string, path string) *redis.StringSliceCmd
func (*Client) JsonObjLen ¶
func (*Client) JsonStrAppend ¶
func (*Client) JsonStrLen ¶
func (*Client) TXPipeline ¶
type Pipeline ¶
Pipeline is an extended redis.Pipeline, stores a pointer to the original redis.Pipeliner
func ExtendPipeline ¶
Example ¶
package main import ( "fmt" "github.com/KromDaniel/rejonson" "github.com/go-redis/redis" "time" ) func main() { goRedisClient := redis.NewClient(&redis.Options{ Addr: "localhost:6379", }) client := rejonson.ExtendClient(goRedisClient) pipeline := client.Pipeline() pipeline.JsonSet("rejson-cmd-pipeline", ".", "[10]") pipeline.JsonNumMultBy("rejson-cmd-pipeline", "[0]", 10) pipeline.Set("go-redis-pipeline-command", "hello from go-redis", time.Second) _, err := pipeline.Exec() if err != nil { // handle error } jsonString, err := client.JsonGet("rejson-cmd-pipeline").Result() if err != nil { // handle error } fmt.Printf("Array %s", jsonString) }
Output: Array [100]
func (*Pipeline) JsonArrAppend ¶
func (*Pipeline) JsonArrIndex ¶
func (*Pipeline) JsonArrInsert ¶
func (*Pipeline) JsonArrLen ¶
func (*Pipeline) JsonArrPop ¶
func (*Pipeline) JsonArrTrim ¶
func (*Pipeline) JsonMGet ¶
func (processor *Pipeline) JsonMGet(key string, args ...interface{}) *redis.StringSliceCmd
func (*Pipeline) JsonNumIncrBy ¶
func (*Pipeline) JsonNumMultBy ¶
func (*Pipeline) JsonObjKeys ¶
func (processor *Pipeline) JsonObjKeys(key string, path string) *redis.StringSliceCmd
func (*Pipeline) JsonObjLen ¶
func (*Pipeline) JsonStrAppend ¶
func (*Pipeline) JsonStrLen ¶
type RedisProcessor ¶ added in v1.0.0
RedisProcessor is redis client or pipeline instance that will process a command
Click to show internal directories.
Click to hide internal directories.