mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
client: add KeysAPI.RGet
This commit is contained in:
parent
6d89e6217d
commit
8b3d05f661
@ -65,6 +65,7 @@ type KeysAPI interface {
|
||||
Update(ctx context.Context, key, value string) (*Response, error)
|
||||
|
||||
Get(ctx context.Context, key string) (*Response, error)
|
||||
RGet(ctx context.Context, key string) (*Response, error)
|
||||
|
||||
Watch(key string, idx uint64) Watcher
|
||||
RWatch(key string, idx uint64) Watcher
|
||||
@ -154,6 +155,21 @@ func (k *httpKeysAPI) Get(ctx context.Context, key string) (*Response, error) {
|
||||
return unmarshalHTTPResponse(resp.StatusCode, resp.Header, body)
|
||||
}
|
||||
|
||||
func (k *httpKeysAPI) RGet(ctx context.Context, key string) (*Response, error) {
|
||||
get := &getAction{
|
||||
Prefix: k.prefix,
|
||||
Key: key,
|
||||
Recursive: true,
|
||||
}
|
||||
|
||||
resp, body, err := k.client.Do(ctx, get)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return unmarshalHTTPResponse(resp.StatusCode, resp.Header, body)
|
||||
}
|
||||
|
||||
func (k *httpKeysAPI) Watch(key string, idx uint64) Watcher {
|
||||
return &httpWatcher{
|
||||
client: k.client,
|
||||
|
Loading…
x
Reference in New Issue
Block a user