jsonpatch

package
v0.0.0-...-c143859 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByPath

type ByPath []PatchOperation

func (ByPath) Len

func (a ByPath) Len() int

func (ByPath) Less

func (a ByPath) Less(i, j int) bool

func (ByPath) Swap

func (a ByPath) Swap(i, j int)

type PatchOperation

type PatchOperation struct {
	Value     interface{} `json:"value,omitempty"`
	Operation string      `json:"op"`
	Path      string      `json:"path"`
}

func CreatePatch

func CreatePatch(a, b []byte) ([]PatchOperation, error)

CreatePatch creates a patch as specified in http://jsonpatch.com/

'a' is original, 'b' is the modified document. Both are to be given as json encoded content. The function will return an array of JsonPatchOperations

An error will be returned if any of the two documents are invalid.

func NewPatch

func NewPatch(operation, path string, value interface{}) PatchOperation

func (*PatchOperation) JSON

func (j *PatchOperation) JSON() string

func (*PatchOperation) MarshalJSON

func (j *PatchOperation) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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