Browse Source

删除KEY

master v0.1.11
guzeng 3 years ago
parent
commit
cce90f4739
3 changed files with 7 additions and 7 deletions
  1. +3
    -3
      redis.pb.go
  2. +1
    -1
      redis.proto
  3. +3
    -3
      string.go

+ 3
- 3
redis.pb.go View File

@ -220,7 +220,7 @@ func (m *SetResponse) GetRet() string {
// 删除key响应结构
type DelResponse struct {
Ret *string `protobuf:"bytes,1,opt,name=ret" json:"ret,omitempty"`
Ret *uint64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
@ -228,11 +228,11 @@ func (m *DelResponse) Reset() { *m = DelResponse{} }
func (m *DelResponse) String() string { return proto.CompactTextString(m) }
func (*DelResponse) ProtoMessage() {}
func (m *DelResponse) GetRet() string {
func (m *DelResponse) GetRet() uint64 {
if m != nil && m.Ret != nil {
return *m.Ret
}
return ""
return 0
}
func init() {


+ 1
- 1
redis.proto View File

@ -45,7 +45,7 @@ message SetResponse {
// key响应结构
message DelResponse {
string ret = 1;
uint64 ret = 1;
}
// rpc方法
service RedisService {


+ 3
- 3
string.go View File

@ -53,12 +53,12 @@ func Set(key, value string, ttl string, url ...string) (string, error) {
}
//设置
func Del(key string, url ...string) (string, error) {
func Del(key string, url ...string) (uint64, error) {
conn, _, err := Conn(url...)
if err != nil {
return "", err
return 0, err
}
defer conn.Close()
@ -69,7 +69,7 @@ func Del(key string, url ...string) (string, error) {
err = conn.Del(req, res)
if err != nil {
return "", err
return 0, err
}
return res.GetRet(), nil


Loading…
Cancel
Save