Skip to content

Commit

Permalink
Add Redis Timeseries support (#2688)
Browse files Browse the repository at this point in the history
* Add Redis Timeseries support

* Small fixes

* Make timeseries interface public

* remove bloom renaming
  • Loading branch information
ofekshenawa authored Sep 11, 2023
1 parent 5bbd80d commit 017466b
Show file tree
Hide file tree
Showing 5 changed files with 1,942 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ URI
url
variadic
RedisStack
RedisGears
RedisGears
RedisTimeseries
59 changes: 59 additions & 0 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,65 @@ func (cmd *MapStringIntCmd) readReply(rd *proto.Reader) error {
return nil
}

// ------------------------------------------------------------------------------
type MapStringSliceInterfaceCmd struct {
baseCmd
val map[string][]interface{}
}

func NewMapStringSliceInterfaceCmd(ctx context.Context, args ...interface{}) *MapStringSliceInterfaceCmd {
return &MapStringSliceInterfaceCmd{
baseCmd: baseCmd{
ctx: ctx,
args: args,
},
}
}

func (cmd *MapStringSliceInterfaceCmd) String() string {
return cmdString(cmd, cmd.val)
}

func (cmd *MapStringSliceInterfaceCmd) SetVal(val map[string][]interface{}) {
cmd.val = val
}

func (cmd *MapStringSliceInterfaceCmd) Result() (map[string][]interface{}, error) {
return cmd.val, cmd.err
}

func (cmd *MapStringSliceInterfaceCmd) Val() map[string][]interface{} {
return cmd.val
}

func (cmd *MapStringSliceInterfaceCmd) readReply(rd *proto.Reader) (err error) {
n, err := rd.ReadMapLen()
if err != nil {
return err
}
cmd.val = make(map[string][]interface{}, n)
for i := 0; i < n; i++ {
k, err := rd.ReadString()
if err != nil {
return err
}
nn, err := rd.ReadArrayLen()
if err != nil {
return err
}
cmd.val[k] = make([]interface{}, nn)
for j := 0; j < nn; j++ {
value, err := rd.ReadReply()
if err != nil {
return err
}
cmd.val[k][j] = value
}
}

return nil
}

//------------------------------------------------------------------------------

type StringStructMapCmd struct {
Expand Down
1 change: 1 addition & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ type Cmdable interface {

gearsCmdable
probabilisticCmdable
TimeseriesCmdable
}

type StatefulCmdable interface {
Expand Down
Loading

0 comments on commit 017466b

Please sign in to comment.