|
|
@ -29,6 +29,7 @@ It has these top-level messages: |
|
|
|
LSetResponse |
|
|
|
LRangeRequest |
|
|
|
LLenRequest |
|
|
|
AddRequest |
|
|
|
*/ |
|
|
|
package redisrpc |
|
|
|
|
|
|
@ -473,6 +474,31 @@ func (m *LLenRequest) GetKey() string { |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
// 数值增加
|
|
|
|
type AddRequest struct { |
|
|
|
Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` |
|
|
|
Value *int64 `protobuf:"varint,2,opt,name=value" json:"value,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
} |
|
|
|
|
|
|
|
func (m *AddRequest) Reset() { *m = AddRequest{} } |
|
|
|
func (m *AddRequest) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*AddRequest) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *AddRequest) GetKey() string { |
|
|
|
if m != nil && m.Key != nil { |
|
|
|
return *m.Key |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func (m *AddRequest) GetValue() int64 { |
|
|
|
if m != nil && m.Value != nil { |
|
|
|
return *m.Value |
|
|
|
} |
|
|
|
return 0 |
|
|
|
} |
|
|
|
|
|
|
|
func init() { |
|
|
|
} |
|
|
|
|
|
|
@ -498,6 +524,8 @@ type RedisService interface { |
|
|
|
LRange(in *LRangeRequest, out *HGetListResponse) error |
|
|
|
LLen(in *LLenRequest, out *LSetResponse) error |
|
|
|
ReduceStock(in *SetRequest, out *SetResponse) error |
|
|
|
Incrby(in *AddRequest, out *SetResponse) error |
|
|
|
Decrby(in *AddRequest, out *SetResponse) error |
|
|
|
} |
|
|
|
|
|
|
|
// AcceptRedisServiceClient accepts connections on the listener and serves requests
|
|
|
@ -632,6 +660,12 @@ func (c *RedisServiceClient) LLen(in *LLenRequest, out *LSetResponse) error { |
|
|
|
func (c *RedisServiceClient) ReduceStock(in *SetRequest, out *SetResponse) error { |
|
|
|
return c.Call("RedisService.ReduceStock", in, out) |
|
|
|
} |
|
|
|
func (c *RedisServiceClient) Incrby(in *AddRequest, out *SetResponse) error { |
|
|
|
return c.Call("RedisService.Incrby", in, out) |
|
|
|
} |
|
|
|
func (c *RedisServiceClient) Decrby(in *AddRequest, out *SetResponse) error { |
|
|
|
return c.Call("RedisService.Decrby", in, out) |
|
|
|
} |
|
|
|
|
|
|
|
// DialRedisService connects to an RedisService at the specified network address.
|
|
|
|
func DialRedisService(network, addr string) (*RedisServiceClient, *rpc.Client, error) { |
|
|
|