jsonpatch

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Operation

type Operation struct {
	Value     interface{}   `json:"value,omitempty"`
	OldValue  interface{}   `json:"-"`
	Operation OperationType `json:"op"`
	// FIXME: From is not used by this package as of now, since we do not support move and copy operations.
	// From string `json:"from,omitempty"`
	Path jsonpointer.Pointer `json:"path"`

	Metadata map[string]string `json:"metadata,omitempty"`
}

Operation represents a single JSON Patch (RFC6902) operation.

func (Operation) GoString

func (o Operation) GoString() string

type OperationType

type OperationType string
const (
	OperationAdd     OperationType = "add"
	OperationReplace OperationType = "replace"
	OperationRemove  OperationType = "remove"
	// FIXME: Operation move and copy are not supported by this package.
	// OperationMove OperationType = "move"
	// OperationCopy OperationType = "copy"
	OperationTest OperationType = "test"
)

JSON Patch operation types. These are defined in RFC 6902 section 4. https://datatracker.ietf.org/doc/html/rfc6902#section-4

func (*OperationType) UnmarshalJSON

func (o *OperationType) UnmarshalJSON(data []byte) error

type Patch

type Patch []Operation

Patch represents a series of JSON Patch operations.

func (Patch) GoString

func (p Patch) GoString() string

Jump to

Keyboard shortcuts

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