@@ -40,7 +40,7 @@ type Cmder interface {
4040
4141 readTimeout () * time.Duration
4242 readReply (rd * proto.Reader ) error
43-
43+ readRawReply ( rd * proto. Reader ) error
4444 SetErr (error )
4545 Err () error
4646}
@@ -122,11 +122,11 @@ func cmdString(cmd Cmder, val interface{}) string {
122122//------------------------------------------------------------------------------
123123
124124type baseCmd struct {
125- ctx context.Context
126- args []interface {}
127- err error
128- keyPos int8
129-
125+ ctx context.Context
126+ args []interface {}
127+ err error
128+ keyPos int8
129+ rawVal interface {}
130130 _readTimeout * time.Duration
131131}
132132
@@ -197,6 +197,11 @@ func (cmd *baseCmd) setReadTimeout(d time.Duration) {
197197 cmd ._readTimeout = & d
198198}
199199
200+ func (cmd * baseCmd ) readRawReply (rd * proto.Reader ) (err error ) {
201+ cmd .rawVal , err = rd .ReadReply ()
202+ return err
203+ }
204+
200205//------------------------------------------------------------------------------
201206
202207type Cmd struct {
@@ -573,6 +578,10 @@ func (cmd *StatusCmd) Result() (string, error) {
573578 return cmd .val , cmd .err
574579}
575580
581+ func (cmd * StatusCmd ) Bytes () ([]byte , error ) {
582+ return util .StringToBytes (cmd .val ), cmd .err
583+ }
584+
576585func (cmd * StatusCmd ) String () string {
577586 return cmdString (cmd , cmd .val )
578587}
@@ -3783,6 +3792,65 @@ func (cmd *MapStringStringSliceCmd) readReply(rd *proto.Reader) error {
37833792 return nil
37843793}
37853794
3795+ // -----------------------------------------------------------------------
3796+ // MapStringInterfaceCmd represents a command that returns a map of strings to interface{}.
3797+ type MapMapStringInterfaceCmd struct {
3798+ baseCmd
3799+ val map [string ]interface {}
3800+ }
3801+
3802+ func NewMapMapStringInterfaceCmd (ctx context.Context , args ... interface {}) * MapMapStringInterfaceCmd {
3803+ return & MapMapStringInterfaceCmd {
3804+ baseCmd : baseCmd {
3805+ ctx : ctx ,
3806+ args : args ,
3807+ },
3808+ }
3809+ }
3810+
3811+ func (cmd * MapMapStringInterfaceCmd ) String () string {
3812+ return cmdString (cmd , cmd .val )
3813+ }
3814+
3815+ func (cmd * MapMapStringInterfaceCmd ) SetVal (val map [string ]interface {}) {
3816+ cmd .val = val
3817+ }
3818+
3819+ func (cmd * MapMapStringInterfaceCmd ) Result () (map [string ]interface {}, error ) {
3820+ return cmd .val , cmd .err
3821+ }
3822+
3823+ func (cmd * MapMapStringInterfaceCmd ) Val () map [string ]interface {} {
3824+ return cmd .val
3825+ }
3826+
3827+ func (cmd * MapMapStringInterfaceCmd ) readReply (rd * proto.Reader ) (err error ) {
3828+ n , err := rd .ReadArrayLen ()
3829+ if err != nil {
3830+ return err
3831+ }
3832+
3833+ data := make (map [string ]interface {}, n / 2 )
3834+ for i := 0 ; i < n ; i += 2 {
3835+ _ , err := rd .ReadArrayLen ()
3836+ if err != nil {
3837+ cmd .err = err
3838+ }
3839+ key , err := rd .ReadString ()
3840+ if err != nil {
3841+ cmd .err = err
3842+ }
3843+ value , err := rd .ReadString ()
3844+ if err != nil {
3845+ cmd .err = err
3846+ }
3847+ data [key ] = value
3848+ }
3849+
3850+ cmd .val = data
3851+ return nil
3852+ }
3853+
37863854//-----------------------------------------------------------------------
37873855
37883856type MapStringInterfaceSliceCmd struct {
@@ -4997,6 +5065,7 @@ type ClientInfo struct {
49975065 PSub int // number of pattern matching subscriptions
49985066 SSub int // redis version 7.0.3, number of shard channel subscriptions
49995067 Multi int // number of commands in a MULTI/EXEC context
5068+ Watch int // redis version 7.4 RC1, number of keys this client is currently watching.
50005069 QueryBuf int // qbuf, query buffer length (0 means no query pending)
50015070 QueryBufFree int // qbuf-free, free space of the query buffer (0 means the buffer is full)
50025071 ArgvMem int // incomplete arguments for the next command (already extracted from query buffer)
@@ -5149,6 +5218,8 @@ func parseClientInfo(txt string) (info *ClientInfo, err error) {
51495218 info .SSub , err = strconv .Atoi (val )
51505219 case "multi" :
51515220 info .Multi , err = strconv .Atoi (val )
5221+ case "watch" :
5222+ info .Watch , err = strconv .Atoi (val )
51525223 case "qbuf" :
51535224 info .QueryBuf , err = strconv .Atoi (val )
51545225 case "qbuf-free" :
0 commit comments