yamlpatch

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2025 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OperationAdd     = "add"
	OperationReplace = "replace"
	OperationRemove  = "remove"
	OperationMove    = "move"
	OperationCopy    = "copy"
	OperationTest    = "test"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Operation

type Operation struct {
	Type  string      `json:"op" yaml:"op"`
	Path  Path        `json:"path" yaml:"path"`
	From  Path        `json:"from,omitempty" yaml:"from,omitempty"`
	Value interface{} `json:"value,omitempty" yaml:"value,omitempty"`

	// If not empty, will be inserted as a head comment above this node
	Comment string `json:"comment,omitempty" yaml:"comment,omitempty"`
}

Operation represents a RFC6902 JSON Patch operation.

func (Operation) String

func (op Operation) String() string

type Patch

type Patch []Operation

type Patcher

type Patcher interface {
	Apply(originalBytes []byte, patch Patch) ([]byte, error)
}

type Path

type Path []string

Path represents a decoded JSON patch targeting a location within a document. Use ParsePath or UnmarshalText to construct a Path.

func MustParsePath

func MustParsePath(str string) Path

MustParsePath is like ParsePath but panics in case of invalid input.

func ParsePath

func ParsePath(str string) (Path, error)

func (Path) Key

func (p Path) Key() string

func (Path) MarshalText

func (p Path) MarshalText() ([]byte, error)

func (Path) String

func (p Path) String() string

func (*Path) UnmarshalText

func (p *Path) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL