|
@ -113,3 +113,27 @@ func HGetAll(key string, url ...string) ([]map[string]string, error) { |
|
|
} |
|
|
} |
|
|
return list, nil |
|
|
return list, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* hash键是否存在 |
|
|
|
|
|
*/ |
|
|
|
|
|
func HExists(key string, field string, url ...string)(int64,error){ |
|
|
|
|
|
conn, _, err := Conn(url...) |
|
|
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return 0, err |
|
|
|
|
|
} |
|
|
|
|
|
defer conn.Close() |
|
|
|
|
|
|
|
|
|
|
|
req := &HGetRequest{proto.String(key), proto.String(field), nil} |
|
|
|
|
|
|
|
|
|
|
|
res := &DelResponse{} |
|
|
|
|
|
|
|
|
|
|
|
err = conn.HExists(req, res) |
|
|
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return 0, err |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return res.GetRet(), nil |
|
|
|
|
|
} |