{"modulePath":"github.com/UnityTech/client-go","version":"v2.0.0+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package strategicpatch\n\n## Functions\n\n```go\nfunc CreateStrategicMergePatch(original, modified []byte, dataStruct interface{}) ([]byte, error)\n```\nDeprecated: Use the synonym CreateTwoWayMergePatch, instead.\n\n```go\nfunc CreateThreeWayMergePatch(original, modified, current []byte, dataStruct interface{}, overwrite bool, fns ...PreconditionFunc) ([]byte, error)\n```\nCreateThreeWayMergePatch reconciles a modified configuration with an original configuration, while preserving any changes or deletions made to the original configuration in the interim, and not overridden by the current configuration. All three documents must be passed to the method as json encoded content. It will return a strategic merge patch, or an error if any of the documents is invalid, or if there are any preconditions that fail against the modified configuration, or, if overwrite is false and there are conflicts between the modified and current configurations. Conflicts are defined as keys changed differently from original to modified than from original to current. In other words, a conflict occurs if modified changes any key in a way that is different from how it is changed in current (e.g., deleting it, changing its value).\n\n```go\nfunc CreateTwoWayMergePatch(original, modified []byte, dataStruct interface{}, fns ...PreconditionFunc) ([]byte, error)\n```\nCreateTwoWayMergePatch creates a patch that can be passed to StrategicMergePatch from an original document and a modified document, which are passed to the method as json encoded content. It will return a patch that yields the modified document when applied to the original document, or an error if either of the two documents is invalid.\n\n```go\nfunc HasConflicts(left, right interface{}) (bool, error)\n```\nHasConflicts returns true if the left and right JSON interface objects overlap with different values in any key. All keys are required to be strings. Since patches of the same Type have congruent keys, this is valid for multiple patch types. This method supports JSON merge patch semantics.\n\n```go\nfunc IsConflict(err error) bool\n```\nIsConflict returns true if the provided error indicates a conflict between the patch and the current configuration.\n\n```go\nfunc IsPreconditionFailed(err error) bool\n```\nIsPreconditionFailed returns true if the provided error indicates a precondition failed.\n\n```go\nfunc MergingMapsHaveConflicts(left, right map[string]interface{}, dataStruct interface{}) (bool, error)\n```\nMergingMapsHaveConflicts returns true if the left and right JSON interface objects overlap with different values in any key. All keys are required to be strings. Since patches of the same Type have congruent keys, this is valid for multiple patch types. This method supports strategic merge patch semantics.\n\n```go\nfunc StrategicMergePatch(original, patch []byte, dataStruct interface{}) ([]byte, error)\n```\nStrategicMergePatch applies a strategic merge patch. The patch and the original document must be json encoded content. A patch can be created from an original and a modified document by calling CreateStrategicMergePatch.\n\n```go\nfunc StrategicMergePatchData(original, patch []byte, dataStruct interface{}) ([]byte, error)\n```\nDeprecated: StrategicMergePatchData is deprecated. Use the synonym StrategicMergePatch, instead, which follows the naming convention of evanphx/json-patch.\n\n## Types\n\n```go\ntype PreconditionFunc func(interface{}) bool\n```\nPreconditionFunc asserts that an incompatible change is not present within a patch.\n\n```go\nfunc RequireKeyUnchanged(key string) PreconditionFunc\n```\nRequireKeyUnchanged returns a precondition function that fails if the provided key is present in the patch (indicating that its value has changed).\n\n```go\nfunc RequireMetadataKeyUnchanged(key string) PreconditionFunc\n```\nRequireMetadataKeyUnchanged creates a precondition function that fails if the metadata.key is present in the patch (indicating its value has changed).\n\n```go\ntype SortableSliceOfMaps struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (ss SortableSliceOfMaps) Len() int\n```\n\n```go\nfunc (ss SortableSliceOfMaps) Less(i, j int) bool\n```\n\n```go\nfunc (ss SortableSliceOfMaps) Swap(i, j int)\n```\n\n```go\ntype SortableSliceOfScalars struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (ss SortableSliceOfScalars) Len() int\n```\n\n```go\nfunc (ss SortableSliceOfScalars) Less(i, j int) bool\n```\n\n```go\nfunc (ss SortableSliceOfScalars) Swap(i, j int)\n```\n\n","path":"github.com/UnityTech/client-go/pkg/util/strategicpatch","name":"strategicpatch","synopsis":"","isRedistributable":true}
