Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByPath ¶
type ByPath []JsonPatchOperation
type Collections ¶
type Collections struct {
EntitySets EntitySets
Arrays []Path
Atomics []Path
}
type EntitySets ¶
func (EntitySets) Add ¶
func (s EntitySets) Add(path Path, key Key)
type JsonPatchOperation ¶
type JsonPatchOperation struct {
Operation string `json:"op"`
Path string `json:"path"`
Value any `json:"value,omitempty"`
}
func CreatePatch ¶
func CreatePatch(a, b []byte, collections Collections, ignoredFields []Path, strategy PatchStrategy) ([]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 If ignoreArrayOrder is true, arrays with the same elements but in different order will be considered equal
An e rror will be returned if any of the two documents are invalid.
func NewPatch ¶
func NewPatch(operation, path string, value any) JsonPatchOperation
func (*JsonPatchOperation) Json ¶
func (j *JsonPatchOperation) Json() string
func (*JsonPatchOperation) MarshalJson ¶
func (j *JsonPatchOperation) MarshalJson() ([]byte, error)
type PatchStrategy ¶
type PatchStrategy string
const ( PatchStrategyExactMatch PatchStrategy = "exact-match" PatchStrategyEnsureExists PatchStrategy = "ensure-exists" PatchStrategyEnsureAbsent PatchStrategy = "ensure-absent" )
Click to show internal directories.
Click to hide internal directories.