Documentation ¶
Index ¶
- Variables
- func CreateMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error)
- func Equal(a, b []byte) bool
- func MergeMergePatches(patch1Data, patch2Data []byte) ([]byte, error)
- func MergePatch(docData, patchData []byte) ([]byte, error)
- type AccumulatedCopySizeError
- type ArraySizeError
- type Operation
- type Patch
Constants ¶
This section is empty.
Variables ¶
var ( // SupportNegativeIndices decides whether to support non-standard practice of // allowing negative indices to mean indices starting at the end of an array. // Default to true. SupportNegativeIndices bool = true // AccumulatedCopySizeLimit limits the total size increase in bytes caused by // "copy" operations in a patch. AccumulatedCopySizeLimit int64 = 0 )
Functions ¶
func CreateMergePatch ¶
CreateMergePatch will return a merge patch document capable of converting the original document(s) to the modified document(s). The parameters can be bytes of either two JSON Documents, or two arrays of JSON documents. The merge patch returned follows the specification defined at http://tools.ietf.org/html/draft-ietf-appsawg-json-merge-patch-07
func Equal ¶
Equal indicates if 2 JSON documents have the same structural equality.
func MergeMergePatches ¶
MergeMergePatches merges two merge patches together, such that applying this resulting merged merge patch to a document yields the same as merging each merge patch to the document in succession.
Types ¶
type AccumulatedCopySizeError ¶
type AccumulatedCopySizeError struct {
// contains filtered or unexported fields
}
AccumulatedCopySizeError is an error type returned when the accumulated size increase caused by copy operations in a patch operation has exceeded the limit.
func NewAccumulatedCopySizeError ¶
func NewAccumulatedCopySizeError(l, a int64) *AccumulatedCopySizeError
NewAccumulatedCopySizeError returns an AccumulatedCopySizeError.
func (*AccumulatedCopySizeError) Error ¶
func (a *AccumulatedCopySizeError) Error() string
Error implements the error interface.
type ArraySizeError ¶
type ArraySizeError struct {
// contains filtered or unexported fields
}
ArraySizeError is an error type returned when the array size has exceeded the limit.
func NewArraySizeError ¶
func NewArraySizeError(l, s int) *ArraySizeError
NewArraySizeError returns an ArraySizeError.
func (*ArraySizeError) Error ¶
func (a *ArraySizeError) Error() string
Error implements the error interface.
type Operation ¶
type Operation map[string]*json.RawMessage
Operation is a single JSON-Patch step, such as a single 'add' operation.
func (Operation) From ¶
From reads the "from" field of the Operation.
func (Operation) Kind ¶
Kind reads the "op" field of the Operation.
func (Operation) Path ¶
Path reads the "path" field of the Operation.