update put

This commit is contained in:
白茶清欢 2023-08-15 13:30:56 +08:00
parent aed09507e6
commit 1cff60709c

View File

@ -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选项读取数据