Browse Source

数量加减方法

master v0.7.0
guzeng 2 years ago
parent
commit
baeafb732c
2 changed files with 41 additions and 0 deletions
  1. +34
    -0
      redis.pb.go
  2. +7
    -0
      redis.proto

+ 34
- 0
redis.pb.go View File

@ -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) {


+ 7
- 0
redis.proto View File

@ -103,6 +103,11 @@ message LLenRequest{
string key = 1;
}
//
message AddRequest {
string key = 1;
int64 value = 2;
}
// rpc方法
service RedisService {
rpc Get (GetRequest) returns (GetStringResponse); // 使key查询
@ -126,4 +131,6 @@ service RedisService {
rpc LRange(LRangeRequest) returns (HGetListResponse); //
rpc LLen(LLenRequest) returns (LSetResponse); //
rpc ReduceStock(SetRequest) returns(SetResponse);//
rpc Incrby(AddRequest) returns(SetResponse);//
rpc Decrby(AddRequest) returns(SetResponse);//
}

Loading…
Cancel
Save