From 101af4a247e76b18361fe55fe6d4ee31d514ac7d Mon Sep 17 00:00:00 2001 From: guzeng Date: Fri, 21 May 2021 11:16:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AEKEY=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- redis.pb.go | 12 ++++++------ redis.proto | 4 ++-- string.go | 4 ++-- string_test.go | 12 ++++++------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/redis.pb.go b/redis.pb.go index e5fec8e..a445657 100644 --- a/redis.pb.go +++ b/redis.pb.go @@ -203,7 +203,7 @@ func (m *GetStringResponse) GetValue() string { // 设置key响应结构 type SetResponse struct { - Ret *uint64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"` + Ret *string `protobuf:"bytes,1,opt,name=ret" json:"ret,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -211,16 +211,16 @@ func (m *SetResponse) Reset() { *m = SetResponse{} } func (m *SetResponse) String() string { return proto.CompactTextString(m) } func (*SetResponse) ProtoMessage() {} -func (m *SetResponse) GetRet() uint64 { +func (m *SetResponse) GetRet() string { if m != nil && m.Ret != nil { return *m.Ret } - return 0 + return "" } // 删除key响应结构 type DelResponse struct { - Ret *uint64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"` + Ret *string `protobuf:"bytes,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() uint64 { +func (m *DelResponse) GetRet() string { if m != nil && m.Ret != nil { return *m.Ret } - return 0 + return "" } func init() { diff --git a/redis.proto b/redis.proto index 6da9bf0..d41846f 100644 --- a/redis.proto +++ b/redis.proto @@ -40,12 +40,12 @@ message GetStringResponse { // 设置key响应结构 message SetResponse { - uint64 ret = 1; + string ret = 1; } // 删除key响应结构 message DelResponse { - uint64 ret = 1; + string ret = 1; } // rpc方法 service RedisService { diff --git a/string.go b/string.go index faacca1..0e337a3 100644 --- a/string.go +++ b/string.go @@ -30,7 +30,7 @@ func GetString(key string, url ...string) (string, error) { } //设置 -func Set(key, value string, ttl string, url ...string) (uint64, error) { +func Set(key, value string, ttl string, url ...string) (string, error) { conn, _, err := Conn(url...) @@ -53,7 +53,7 @@ func Set(key, value string, ttl string, url ...string) (uint64, error) { } //设置 -func Del(key string, url ...string) (uint64, error) { +func Del(key string, url ...string) (string, error) { conn, _, err := Conn(url...) diff --git a/string_test.go b/string_test.go index 549985c..4a8b19c 100644 --- a/string_test.go +++ b/string_test.go @@ -15,16 +15,16 @@ import ( func Test_Set(t *testing.T) { - c, err := Set("test", "1111", 7200) + c, err := Set("test", "1111", "7200") t.Log(c) t.Log(err) } -// func Test_Del(t *testing.T) { +func Test_Del(t *testing.T) { -// c, err := Del("test") -// t.Log(c) -// t.Log(err) + c, err := Del("test") + t.Log(c) + t.Log(err) -// } +}