Browse Source

增加取列表长度方法

master v0.5.1
guzeng 3 years ago
parent
commit
f8bb76a3bb
2 changed files with 27 additions and 0 deletions
  1. +22
    -0
      redis.pb.go
  2. +5
    -0
      redis.proto

+ 22
- 0
redis.pb.go View File

@ -28,6 +28,7 @@ It has these top-level messages:
LSetRequest LSetRequest
LSetResponse LSetResponse
LRangeRequest LRangeRequest
LLenRequest
*/ */
package redisrpc package redisrpc
@ -455,6 +456,23 @@ func (m *LRangeRequest) GetStop() int64 {
return 0 return 0
} }
// 列表长度
type LLenRequest struct {
Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *LLenRequest) Reset() { *m = LLenRequest{} }
func (m *LLenRequest) String() string { return proto.CompactTextString(m) }
func (*LLenRequest) ProtoMessage() {}
func (m *LLenRequest) GetKey() string {
if m != nil && m.Key != nil {
return *m.Key
}
return ""
}
func init() { func init() {
} }
@ -476,6 +494,7 @@ type RedisService interface {
LLpush(in *LSetRequest, out *LSetResponse) error LLpush(in *LSetRequest, out *LSetResponse) error
LRpush(in *LSetRequest, out *LSetResponse) error LRpush(in *LSetRequest, out *LSetResponse) error
LRange(in *LRangeRequest, out *HGetListResponse) error LRange(in *LRangeRequest, out *HGetListResponse) error
LLen(in *LLenRequest, out *LSetResponse) error
} }
// AcceptRedisServiceClient accepts connections on the listener and serves requests // AcceptRedisServiceClient accepts connections on the listener and serves requests
@ -598,6 +617,9 @@ func (c *RedisServiceClient) LRpush(in *LSetRequest, out *LSetResponse) error {
func (c *RedisServiceClient) LRange(in *LRangeRequest, out *HGetListResponse) error { func (c *RedisServiceClient) LRange(in *LRangeRequest, out *HGetListResponse) error {
return c.Call("RedisService.LRange", in, out) return c.Call("RedisService.LRange", in, out)
} }
func (c *RedisServiceClient) LLen(in *LLenRequest, out *LSetResponse) error {
return c.Call("RedisService.LLen", in, out)
}
// DialRedisService connects to an RedisService at the specified network address. // DialRedisService connects to an RedisService at the specified network address.
func DialRedisService(network, addr string) (*RedisServiceClient, *rpc.Client, error) { func DialRedisService(network, addr string) (*RedisServiceClient, *rpc.Client, error) {


+ 5
- 0
redis.proto View File

@ -98,6 +98,10 @@ message LRangeRequest{
int64 start = 2; int64 start = 2;
int64 stop = 3; int64 stop = 3;
} }
//
message LLenRequest{
string key = 1;
}
// rpc方法 // rpc方法
service RedisService { service RedisService {
@ -118,4 +122,5 @@ service RedisService {
rpc LLpush(LSetRequest) returns (LSetResponse); // rpc LLpush(LSetRequest) returns (LSetResponse); //
rpc LRpush(LSetRequest) returns (LSetResponse); // rpc LRpush(LSetRequest) returns (LSetResponse); //
rpc LRange(LRangeRequest) returns (HGetListResponse); // rpc LRange(LRangeRequest) returns (HGetListResponse); //
rpc LLen(LLenRequest) returns (LSetResponse); //
} }

Loading…
Cancel
Save