mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
clientv3: add KV constructor using pb.KVClient
This commit is contained in:
parent
54df540c2c
commit
17e0164f57
@ -85,6 +85,10 @@ func NewKV(c *Client) KV {
|
||||
return &kv{remote: pb.NewKVClient(c.conn)}
|
||||
}
|
||||
|
||||
func NewKVFromKVClient(remote pb.KVClient) KV {
|
||||
return &kv{remote: remote}
|
||||
}
|
||||
|
||||
func (kv *kv) Put(ctx context.Context, key, val string, opts ...OpOption) (*PutResponse, error) {
|
||||
r, err := kv.Do(ctx, OpPut(key, val, opts...))
|
||||
return r.put, toErr(ctx, err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user