mirror of
https://github.com/go-gitea/gitea
synced 2024-07-07 10:35:48 +00:00
* Dropped unused codekit config * Integrated dynamic and static bindata for public * Ignore public bindata * Add a general generate make task * Integrated flexible public assets into web command * Updated vendoring, added all missiong govendor deps * Made the linter happy with the bindata and dynamic code * Moved public bindata definition to modules directory * Ignoring the new bindata path now * Updated to the new public modules import path * Updated public bindata command and drop the new prefix
33 lines
841 B
Go
33 lines
841 B
Go
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.Unmarshal()
|
|
}
|
|
|
|
func (c *Client) RawGet(key string, sort, recursive bool) (*RawResponse, error) {
|
|
var q bool
|
|
if c.config.Consistency == STRONG_CONSISTENCY {
|
|
q = true
|
|
}
|
|
ops := Options{
|
|
"recursive": recursive,
|
|
"sorted": sort,
|
|
"quorum": q,
|
|
}
|
|
|
|
return c.get(key, ops)
|
|
}
|