Skip to content

Commit

Permalink
add HMGET command
Browse files Browse the repository at this point in the history
  • Loading branch information
qm1004 committed Jan 20, 2014
1 parent b484146 commit 2a2ce58
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,19 @@ func (client *Client) Hmset(key string, mapping interface{}) error {
return nil
}

func (client *Client) Hmget(key string, fields ...string) ([][]byte, error) {
var args []string
args = append(args, key)
for _, field := range fields {
args = append(args, field)
}
res, err := client.sendCommand("HMGET", args...)
if err != nil {
return nil, err
}
return res.([][]byte), nil
}

func (client *Client) Hincrby(key string, field string, val int64) (int64, error) {
res, err := client.sendCommand("HINCRBY", key, field, strconv.FormatInt(val, 10))
if err != nil {
Expand Down

0 comments on commit 2a2ce58

Please sign in to comment.