Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrTestFailed = errors.New("test failed") ErrMissing = errors.New("missing value") ErrMissingKey = errors.New("missing key") ErrUnknownType = errors.New("unknown object type") ErrInvalid = errors.New("invalid state detected") ErrInvalidIndex = errors.New("invalid index referenced") ErrInvalidPatchFormat = errors.New("invalid patch format") ErrAccumulatedCopySize = errors.New("accumulated copy size limit exceeded") )
var AccumulatedCopySizeLimit int64 = 0
AccumulatedCopySizeLimit limits the total size increase in bytes caused by "copy" operations in a patch. If 0, there's no limit.
var SupportNegativeIndices = true
SupportNegativeIndices decides whether to support non-standard practice of allowing negative indices to mean indices starting at the end of an array. Default to true (mirroring the behavior in the provided jsonpatch example).
Functions ¶
Types ¶
type Operation ¶
type Operation map[string]interface{}
Operation is a single YAML Patch step, such as an "add" operation.
func (Operation) ValueInterface ¶
ValueInterface decodes the "value" field from the Operation back into a Go interface{}, similar to the jsonpatch ValueInterface method.
type Patch ¶
type Patch []Operation
Patch is an ordered collection of Operations.
func DecodePatch ¶
DecodePatch decodes a YAML patch document into a Patch. The patch document itself is expected to be a sequence of operations.
Example of a YAML patch document:
```yaml
op: add path: /items/- value: name: "New item"
op: remove path: /items/1
```