jsonpatch: github.com/mattbaird/jsonpatch Index | Files

package jsonpatch

import "github.com/mattbaird/jsonpatch"


Package Files


type ByPath Uses

type ByPath []JsonPatchOperation

func (ByPath) Len Uses

func (a ByPath) Len() int

func (ByPath) Less Uses

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

func (ByPath) Swap Uses

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

type JsonPatchOperation Uses

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

func CreatePatch Uses

func CreatePatch(a, b []byte) ([]JsonPatchOperation, 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 Uses

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

func (*JsonPatchOperation) Json Uses

func (j *JsonPatchOperation) Json() string

func (*JsonPatchOperation) MarshalJSON Uses

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

Package jsonpatch imports 5 packages (graph) and is imported by 43 packages. Updated 2018-03-06. Refresh now. Tools for package owners.