|
|
@ -9,9 +9,15 @@ It is generated from these files: |
|
|
|
redis.proto |
|
|
|
|
|
|
|
It has these top-level messages: |
|
|
|
GetKey |
|
|
|
GetHashKey |
|
|
|
GetResponse |
|
|
|
GetRequest |
|
|
|
SetRequest |
|
|
|
DelRequest |
|
|
|
HGetRequest |
|
|
|
HSetRequest |
|
|
|
HDelRequest |
|
|
|
GetStringResponse |
|
|
|
SetResponse |
|
|
|
DelResponse |
|
|
|
*/ |
|
|
|
package redisrpc |
|
|
|
|
|
|
@ -30,16 +36,57 @@ var _ = proto.Marshal |
|
|
|
var _ = math.Inf |
|
|
|
|
|
|
|
// 使用key查询
|
|
|
|
type GetKey struct { |
|
|
|
type GetRequest struct { |
|
|
|
Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
} |
|
|
|
|
|
|
|
func (m *GetKey) Reset() { *m = GetKey{} } |
|
|
|
func (m *GetKey) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*GetKey) ProtoMessage() {} |
|
|
|
func (m *GetRequest) Reset() { *m = GetRequest{} } |
|
|
|
func (m *GetRequest) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*GetRequest) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *GetKey) GetKey() string { |
|
|
|
func (m *GetRequest) GetKey() string { |
|
|
|
if m != nil && m.Key != nil { |
|
|
|
return *m.Key |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
// 设置key
|
|
|
|
type SetRequest struct { |
|
|
|
Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` |
|
|
|
Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
} |
|
|
|
|
|
|
|
func (m *SetRequest) Reset() { *m = SetRequest{} } |
|
|
|
func (m *SetRequest) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*SetRequest) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *SetRequest) GetKey() string { |
|
|
|
if m != nil && m.Key != nil { |
|
|
|
return *m.Key |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func (m *SetRequest) GetValue() string { |
|
|
|
if m != nil && m.Value != nil { |
|
|
|
return *m.Value |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
type DelRequest struct { |
|
|
|
Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
} |
|
|
|
|
|
|
|
func (m *DelRequest) Reset() { *m = DelRequest{} } |
|
|
|
func (m *DelRequest) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*DelRequest) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *DelRequest) GetKey() string { |
|
|
|
if m != nil && m.Key != nil { |
|
|
|
return *m.Key |
|
|
|
} |
|
|
@ -47,24 +94,82 @@ func (m *GetKey) GetKey() string { |
|
|
|
} |
|
|
|
|
|
|
|
// 使用hash key查询
|
|
|
|
type GetHashKey struct { |
|
|
|
type HGetRequest 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 *HGetRequest) Reset() { *m = HGetRequest{} } |
|
|
|
func (m *HGetRequest) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*HGetRequest) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *HGetRequest) GetKey() string { |
|
|
|
if m != nil && m.Key != nil { |
|
|
|
return *m.Key |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func (m *HGetRequest) GetField() string { |
|
|
|
if m != nil && m.Field != nil { |
|
|
|
return *m.Field |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
// 设置hash key
|
|
|
|
type HSetRequest struct { |
|
|
|
Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` |
|
|
|
Field *string `protobuf:"bytes,2,opt,name=field" json:"field,omitempty"` |
|
|
|
Value *string `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
} |
|
|
|
|
|
|
|
func (m *HSetRequest) Reset() { *m = HSetRequest{} } |
|
|
|
func (m *HSetRequest) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*HSetRequest) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *HSetRequest) GetKey() string { |
|
|
|
if m != nil && m.Key != nil { |
|
|
|
return *m.Key |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func (m *HSetRequest) GetField() string { |
|
|
|
if m != nil && m.Field != nil { |
|
|
|
return *m.Field |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func (m *HSetRequest) GetValue() string { |
|
|
|
if m != nil && m.Value != nil { |
|
|
|
return *m.Value |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
// 删除hash key
|
|
|
|
type HDelRequest 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 *GetHashKey) Reset() { *m = GetHashKey{} } |
|
|
|
func (m *GetHashKey) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*GetHashKey) ProtoMessage() {} |
|
|
|
func (m *HDelRequest) Reset() { *m = HDelRequest{} } |
|
|
|
func (m *HDelRequest) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*HDelRequest) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *GetHashKey) GetKey() string { |
|
|
|
func (m *HDelRequest) GetKey() string { |
|
|
|
if m != nil && m.Key != nil { |
|
|
|
return *m.Key |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func (m *GetHashKey) GetField() string { |
|
|
|
func (m *HDelRequest) GetField() string { |
|
|
|
if m != nil && m.Field != nil { |
|
|
|
return *m.Field |
|
|
|
} |
|
|
@ -72,28 +177,66 @@ func (m *GetHashKey) GetField() string { |
|
|
|
} |
|
|
|
|
|
|
|
// 使用key查询响应结构
|
|
|
|
type GetResponse struct { |
|
|
|
String_ *string `protobuf:"bytes,1,opt,name=string" json:"string,omitempty"` |
|
|
|
type GetStringResponse struct { |
|
|
|
Value *string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
} |
|
|
|
|
|
|
|
func (m *GetResponse) Reset() { *m = GetResponse{} } |
|
|
|
func (m *GetResponse) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*GetResponse) ProtoMessage() {} |
|
|
|
func (m *GetStringResponse) Reset() { *m = GetStringResponse{} } |
|
|
|
func (m *GetStringResponse) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*GetStringResponse) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *GetResponse) GetString_() string { |
|
|
|
if m != nil && m.String_ != nil { |
|
|
|
return *m.String_ |
|
|
|
func (m *GetStringResponse) GetValue() string { |
|
|
|
if m != nil && m.Value != nil { |
|
|
|
return *m.Value |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
// 设置key响应结构
|
|
|
|
type SetResponse struct { |
|
|
|
Ret *uint32 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
} |
|
|
|
|
|
|
|
func (m *SetResponse) Reset() { *m = SetResponse{} } |
|
|
|
func (m *SetResponse) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*SetResponse) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *SetResponse) GetRet() uint32 { |
|
|
|
if m != nil && m.Ret != nil { |
|
|
|
return *m.Ret |
|
|
|
} |
|
|
|
return 0 |
|
|
|
} |
|
|
|
|
|
|
|
// 删除key响应结构
|
|
|
|
type DelResponse struct { |
|
|
|
Ret *uint32 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
} |
|
|
|
|
|
|
|
func (m *DelResponse) Reset() { *m = DelResponse{} } |
|
|
|
func (m *DelResponse) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*DelResponse) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *DelResponse) GetRet() uint32 { |
|
|
|
if m != nil && m.Ret != nil { |
|
|
|
return *m.Ret |
|
|
|
} |
|
|
|
return 0 |
|
|
|
} |
|
|
|
|
|
|
|
func init() { |
|
|
|
} |
|
|
|
|
|
|
|
type RedisService interface { |
|
|
|
GetByKey(in *GetKey, out *GetResponse) error |
|
|
|
GetByHashKey(in *GetHashKey, out *GetResponse) error |
|
|
|
Get(in *GetRequest, out *GetStringResponse) error |
|
|
|
Set(in *SetRequest, out *SetResponse) error |
|
|
|
Del(in *DelRequest, out *DelResponse) error |
|
|
|
HGet(in *HGetRequest, out *GetStringResponse) error |
|
|
|
HSet(in *HSetRequest, out *SetResponse) error |
|
|
|
HDel(in *HDelRequest, out *DelResponse) error |
|
|
|
} |
|
|
|
|
|
|
|
// AcceptRedisServiceClient accepts connections on the listener and serves requests
|
|
|
@ -165,11 +308,23 @@ func NewRedisServiceClient(conn io.ReadWriteCloser) (*RedisServiceClient, *rpc.C |
|
|
|
return &RedisServiceClient{c}, c |
|
|
|
} |
|
|
|
|
|
|
|
func (c *RedisServiceClient) GetByKey(in *GetKey, out *GetResponse) error { |
|
|
|
return c.Call("RedisService.GetByKey", in, out) |
|
|
|
func (c *RedisServiceClient) Get(in *GetRequest, out *GetStringResponse) error { |
|
|
|
return c.Call("RedisService.Get", in, out) |
|
|
|
} |
|
|
|
func (c *RedisServiceClient) Set(in *SetRequest, out *SetResponse) error { |
|
|
|
return c.Call("RedisService.Set", in, out) |
|
|
|
} |
|
|
|
func (c *RedisServiceClient) Del(in *DelRequest, out *DelResponse) error { |
|
|
|
return c.Call("RedisService.Del", in, out) |
|
|
|
} |
|
|
|
func (c *RedisServiceClient) HGet(in *HGetRequest, out *GetStringResponse) error { |
|
|
|
return c.Call("RedisService.HGet", in, out) |
|
|
|
} |
|
|
|
func (c *RedisServiceClient) HSet(in *HSetRequest, out *SetResponse) error { |
|
|
|
return c.Call("RedisService.HSet", in, out) |
|
|
|
} |
|
|
|
func (c *RedisServiceClient) GetByHashKey(in *GetHashKey, out *GetResponse) error { |
|
|
|
return c.Call("RedisService.GetByHashKey", in, out) |
|
|
|
func (c *RedisServiceClient) HDel(in *HDelRequest, out *DelResponse) error { |
|
|
|
return c.Call("RedisService.HDel", in, out) |
|
|
|
} |
|
|
|
|
|
|
|
// DialRedisService connects to an RedisService at the specified network address.
|
|
|
|