|
|
@ -0,0 +1,30 @@ |
|
|
|
package redisrpc |
|
|
|
|
|
|
|
import ( |
|
|
|
"github.com/golang/protobuf/proto" |
|
|
|
) |
|
|
|
|
|
|
|
/** |
|
|
|
* 使用用户名查询 |
|
|
|
*/ |
|
|
|
func ReduceStock(key string, value string, url ...string) (string, error) { |
|
|
|
|
|
|
|
conn, _, err := Conn(url...) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
} |
|
|
|
defer conn.Close() |
|
|
|
|
|
|
|
req := &SetRequest{proto.String(key), proto.String(value), proto.Int64(0), nil} |
|
|
|
|
|
|
|
res := &SetResponse{} |
|
|
|
|
|
|
|
err = conn.ReduceStock(req, res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
} |
|
|
|
|
|
|
|
return res.GetRet(), nil |
|
|
|
} |