b6a95a8cb3
* 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
40 lines
962 B
Go
40 lines
962 B
Go
package etcd
|
|
|
|
// Delete deletes the given key.
|
|
//
|
|
// When recursive set to false, if the key points to a
|
|
// directory the method will fail.
|
|
//
|
|
// When recursive set to true, if the key points to a file,
|
|
// the file will be deleted; if the key points to a directory,
|
|
// then everything under the directory (including all child directories)
|
|
// will be deleted.
|
|
func (c *Client) Delete(key string, recursive bool) (*Response, error) {
|
|
raw, err := c.RawDelete(key, recursive, false)
|
|
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return raw.Unmarshal()
|
|
}
|
|
|
|
// DeleteDir deletes an empty directory or a key value pair
|
|
func (c *Client) DeleteDir(key string) (*Response, error) {
|
|
raw, err := c.RawDelete(key, false, true)
|
|
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return raw.Unmarshal()
|
|
}
|
|
|
|
func (c *Client) RawDelete(key string, recursive bool, dir bool) (*RawResponse, error) {
|
|
ops := Options{
|
|
"recursive": recursive,
|
|
"dir": dir,
|
|
}
|
|
|
|
return c.delete(key, ops)
|
|
}
|