From 1cff60709cf8a907d766b0517ed7000887ab8db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 15 Aug 2023 13:30:56 +0800 Subject: [PATCH] update put --- string.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/string.go b/string.go index 8bc3ec3..09cb270 100644 --- a/string.go +++ b/string.go @@ -20,21 +20,22 @@ import ( // Author : go_developer@163.com<白茶清欢> // // Date : 12:09 下午 2021/11/23 -func (wc *WrapperClient) Put(ctx context.Context, key string, val string, operateTimeout time.Duration) error { +func (wc *WrapperClient) Put(ctx context.Context, key string, val string, operateTimeout time.Duration) (*clientv3.PutResponse, error) { if operateTimeout <= 0 { operateTimeout = DefaultPutTimeout } var ( - cancel context.CancelFunc - err error + cancel context.CancelFunc + err error + response *clientv3.PutResponse ) if nil == ctx { ctx = context.Background() } ctx, cancel = context.WithTimeout(ctx, operateTimeout) - _, err = wc.client.Put(ctx, key, val) + response, err = wc.client.Put(ctx, key, val) cancel() - return err + return response, err } // GetWithOption 使用各种option选项读取数据