forked from etcd-io/etcd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get.go
27 lines (22 loc) · 749 Bytes
/
get.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package etcd
// Get gets the file or directory associated with the given key.
// If the key points to a directory, files and directories under
// it will be returned in sorted or unsorted order, depending on
// the sort flag.
// If recursive is set to false, contents under child directories
// will not be returned.
// If recursive is set to true, all the contents will be returned.
func (c *Client) Get(key string, sort, recursive bool) (*Response, error) {
raw, err := c.RawGet(key, sort, recursive)
if err != nil {
return nil, err
}
return raw.toResponse()
}
func (c *Client) RawGet(key string, sort, recursive bool) (*RawResponse, error) {
ops := options{
"recursive": recursive,
"sorted": sort,
}
return c.get(key, ops)
}