lingrino/vaku

View on GitHub
api/path_move.go

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
package vaku

import (
    "errors"
)

var (
    // ErrPathMove when PathMove fails.
    ErrPathMove = errors.New("path move")
)

// PathMove moves data at a source path to a destination path (copy + delete).
func (c *Client) PathMove(src, dst string) error {
    err := c.PathCopy(src, dst)
    if err != nil {
        return newWrapErr("", ErrPathMove, err)
    }

    err = c.PathDelete(src)
    if err != nil {
        return newWrapErr(dst, ErrPathMove, err)
    }

    return nil
}