From 2a2ce58b1ccc3314d058fdfa3d81f3c4d2574b77 Mon Sep 17 00:00:00 2001 From: qianmin Date: Mon, 20 Jan 2014 18:03:06 +0800 Subject: [PATCH] add HMGET command --- redis.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/redis.go b/redis.go index ff84e10..0448e95 100644 --- a/redis.go +++ b/redis.go @@ -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 {