Fix HMSet to accept interface{} value.

This commit is contained in:
Vladimir Mihailenco 2017-02-18 15:42:12 +02:00
parent 135cb12c76
commit 56ddaf1199
2 changed files with 3 additions and 3 deletions

View File

@ -111,7 +111,7 @@ type Cmdable interface {
HKeys(key string) *StringSliceCmd HKeys(key string) *StringSliceCmd
HLen(key string) *IntCmd HLen(key string) *IntCmd
HMGet(key string, fields ...string) *SliceCmd HMGet(key string, fields ...string) *SliceCmd
HMSet(key string, fields map[string]string) *StatusCmd HMSet(key string, fields map[string]interface{}) *StatusCmd
HSet(key, field string, value interface{}) *BoolCmd HSet(key, field string, value interface{}) *BoolCmd
HSetNX(key, field string, value interface{}) *BoolCmd HSetNX(key, field string, value interface{}) *BoolCmd
HVals(key string) *StringSliceCmd HVals(key string) *StringSliceCmd
@ -880,7 +880,7 @@ func (c *cmdable) HMGet(key string, fields ...string) *SliceCmd {
return cmd return cmd
} }
func (c *cmdable) HMSet(key string, fields map[string]string) *StatusCmd { func (c *cmdable) HMSet(key string, fields map[string]interface{}) *StatusCmd {
args := make([]interface{}, 2+len(fields)*2) args := make([]interface{}, 2+len(fields)*2)
args[0] = "hmset" args[0] = "hmset"
args[1] = key args[1] = key

View File

@ -1223,7 +1223,7 @@ var _ = Describe("Commands", func() {
}) })
It("should HMSet", func() { It("should HMSet", func() {
ok, err := client.HMSet("hash", map[string]string{ ok, err := client.HMSet("hash", map[string]interface{}{
"key1": "hello1", "key1": "hello1",
"key2": "hello2", "key2": "hello2",
}).Result() }).Result()