package module
v2.4.0 Latest Latest

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 5 Imported by: 170




This section is empty.


This section is empty.


This section is empty.


type ByPath

type ByPath []Operation

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 JsonPatchOperation

type JsonPatchOperation = Operation

type Operation

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

func CreatePatch

func CreatePatch(a, b []byte) ([]Operation, 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 NewOperation added in v2.1.0

func NewOperation(op, path string, value interface{}) Operation

func (*Operation) Json

func (j *Operation) Json() string

func (*Operation) MarshalJSON

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

Jump to

Keyboard shortcuts

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