Browse Source

增加集合的操作

master
guzeng 3 years ago
parent
commit
e63eb33904
2 changed files with 64 additions and 0 deletions
  1. +52
    -0
      redis.pb.go
  2. +12
    -0
      redis.proto

+ 52
- 0
redis.pb.go View File

@ -22,6 +22,8 @@ It has these top-level messages:
DelResponse DelResponse
HSetResponse HSetResponse
SetExpireResponse SetExpireResponse
SAddRequest
SMembersRequest
*/ */
package redisrpc package redisrpc
@ -315,6 +317,48 @@ func (m *SetExpireResponse) GetRet() int64 {
return 0 return 0
} }
// 集合添加值
type SAddRequest struct {
Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *SAddRequest) Reset() { *m = SAddRequest{} }
func (m *SAddRequest) String() string { return proto.CompactTextString(m) }
func (*SAddRequest) ProtoMessage() {}
func (m *SAddRequest) GetKey() string {
if m != nil && m.Key != nil {
return *m.Key
}
return ""
}
func (m *SAddRequest) GetField() string {
if m != nil && m.Field != nil {
return *m.Field
}
return ""
}
// 集合添加值
type SMembersRequest struct {
Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *SMembersRequest) Reset() { *m = SMembersRequest{} }
func (m *SMembersRequest) String() string { return proto.CompactTextString(m) }
func (*SMembersRequest) ProtoMessage() {}
func (m *SMembersRequest) GetKey() string {
if m != nil && m.Key != nil {
return *m.Key
}
return ""
}
func init() { func init() {
} }
@ -329,6 +373,8 @@ type RedisService interface {
HGetAll(in *GetRequest, out *HGetListResponse) error HGetAll(in *GetRequest, out *HGetListResponse) error
HExists(in *HGetRequest, out *DelResponse) error HExists(in *HGetRequest, out *DelResponse) error
Exists(in *GetRequest, out *DelResponse) error Exists(in *GetRequest, out *DelResponse) error
SAdd(in *SAddRequest, out *HSetResponse) error
SIsmember(in *SAddRequest, out *HSetResponse) error
} }
// AcceptRedisServiceClient accepts connections on the listener and serves requests // AcceptRedisServiceClient accepts connections on the listener and serves requests
@ -430,6 +476,12 @@ func (c *RedisServiceClient) HExists(in *HGetRequest, out *DelResponse) error {
func (c *RedisServiceClient) Exists(in *GetRequest, out *DelResponse) error { func (c *RedisServiceClient) Exists(in *GetRequest, out *DelResponse) error {
return c.Call("RedisService.Exists", in, out) return c.Call("RedisService.Exists", in, out)
} }
func (c *RedisServiceClient) SAdd(in *SAddRequest, out *HSetResponse) error {
return c.Call("RedisService.SAdd", in, out)
}
func (c *RedisServiceClient) SIsmember(in *SAddRequest, out *HSetResponse) error {
return c.Call("RedisService.SIsmember", 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) {


+ 12
- 0
redis.proto View File

@ -67,6 +67,16 @@ message SetExpireResponse {
int64 ret = 1; int64 ret = 1;
} }
//
message SAddRequest{
string key = 1;
string field = 2;
}
//
message SMembersRequest{
string key = 1;
}
// rpc方法 // rpc方法
service RedisService { service RedisService {
rpc Get (GetRequest) returns (GetStringResponse); // 使key查询 rpc Get (GetRequest) returns (GetStringResponse); // 使key查询
@ -79,4 +89,6 @@ service RedisService {
rpc HGetAll(GetRequest) returns (HGetListResponse); //get hash all rpc HGetAll(GetRequest) returns (HGetListResponse); //get hash all
rpc HExists(HGetRequest) returns (DelResponse); //hash键是否存在 rpc HExists(HGetRequest) returns (DelResponse); //hash键是否存在
rpc Exists(GetRequest) returns (DelResponse); // rpc Exists(GetRequest) returns (DelResponse); //
rpc SAdd(SAddRequest) returns (HSetResponse); //
rpc SIsmember(SAddRequest) returns (HSetResponse); //
} }

Loading…
Cancel
Save