Browse Source

增加集合rem的操作

master v0.4.1
guzeng 3 years ago
parent
commit
bdf4e2045f
2 changed files with 41 additions and 14 deletions
  1. +33
    -11
      redis.pb.go
  2. +8
    -3
      redis.proto

+ 33
- 11
redis.pb.go View File

@ -22,8 +22,9 @@ It has these top-level messages:
DelResponse DelResponse
HSetResponse HSetResponse
SetExpireResponse SetExpireResponse
SAddRequest
SSetRequest
SMembersRequest SMembersRequest
SSetResponse
*/ */
package redisrpc package redisrpc
@ -318,24 +319,24 @@ func (m *SetExpireResponse) GetRet() int64 {
} }
// 集合添加值 // 集合添加值
type SAddRequest struct {
type SSetRequest struct {
Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"` Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
} }
func (m *SAddRequest) Reset() { *m = SAddRequest{} }
func (m *SAddRequest) String() string { return proto.CompactTextString(m) }
func (*SAddRequest) ProtoMessage() {}
func (m *SSetRequest) Reset() { *m = SSetRequest{} }
func (m *SSetRequest) String() string { return proto.CompactTextString(m) }
func (*SSetRequest) ProtoMessage() {}
func (m *SAddRequest) GetKey() string {
func (m *SSetRequest) GetKey() string {
if m != nil && m.Key != nil { if m != nil && m.Key != nil {
return *m.Key return *m.Key
} }
return "" return ""
} }
func (m *SAddRequest) GetField() string {
func (m *SSetRequest) GetField() string {
if m != nil && m.Field != nil { if m != nil && m.Field != nil {
return *m.Field return *m.Field
} }
@ -359,6 +360,23 @@ func (m *SMembersRequest) GetKey() string {
return "" return ""
} }
// 设置响应结构
type SSetResponse struct {
Ret *int64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *SSetResponse) Reset() { *m = SSetResponse{} }
func (m *SSetResponse) String() string { return proto.CompactTextString(m) }
func (*SSetResponse) ProtoMessage() {}
func (m *SSetResponse) GetRet() int64 {
if m != nil && m.Ret != nil {
return *m.Ret
}
return 0
}
func init() { func init() {
} }
@ -373,8 +391,9 @@ 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
SAdd(in *SSetRequest, out *SSetResponse) error
SIsmember(in *SSetRequest, out *SSetResponse) error
SRem(in *SSetRequest, out *SSetResponse) error
} }
// AcceptRedisServiceClient accepts connections on the listener and serves requests // AcceptRedisServiceClient accepts connections on the listener and serves requests
@ -476,12 +495,15 @@ 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 {
func (c *RedisServiceClient) SAdd(in *SSetRequest, out *SSetResponse) error {
return c.Call("RedisService.SAdd", in, out) return c.Call("RedisService.SAdd", in, out)
} }
func (c *RedisServiceClient) SIsmember(in *SAddRequest, out *HSetResponse) error {
func (c *RedisServiceClient) SIsmember(in *SSetRequest, out *SSetResponse) error {
return c.Call("RedisService.SIsmember", in, out) return c.Call("RedisService.SIsmember", in, out)
} }
func (c *RedisServiceClient) SRem(in *SSetRequest, out *SSetResponse) error {
return c.Call("RedisService.SRem", 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) {


+ 8
- 3
redis.proto View File

@ -68,7 +68,7 @@ message SetExpireResponse {
} }
// //
message SAddRequest{
message SSetRequest{
string key = 1; string key = 1;
string field = 2; string field = 2;
} }
@ -76,6 +76,10 @@ message SAddRequest{
message SMembersRequest{ message SMembersRequest{
string key = 1; string key = 1;
} }
//
message SSetResponse {
int64 ret = 1;
}
// rpc方法 // rpc方法
service RedisService { service RedisService {
@ -89,6 +93,7 @@ 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); //
rpc SAdd(SSetRequest) returns (SSetResponse); //
rpc SIsmember(SSetRequest) returns (SSetResponse); //
rpc SRem(SSetRequest) returns (SSetResponse); //
} }

Loading…
Cancel
Save