Documentation
¶
Index ¶
- func CreateStrategicMergePatch(original, modified []byte, dataStruct interface{}) ([]byte, error)deprecated
- func CreateThreeWayMergePatch(original, modified, current []byte, dataStruct interface{}, overwrite bool, ...) ([]byte, error)
- func CreateTwoWayMergePatch(original, modified []byte, dataStruct interface{}, fns ...PreconditionFunc) ([]byte, error)
- func HasConflicts(left, right interface{}) (bool, error)
- func IsConflict(err error) bool
- func IsPreconditionFailed(err error) bool
- func MergingMapsHaveConflicts(left, right map[string]interface{}, dataStruct interface{}) (bool, error)
- func StrategicMergePatch(original, patch []byte, dataStruct interface{}) ([]byte, error)
- func StrategicMergePatchData(original, patch []byte, dataStruct interface{}) ([]byte, error)deprecated
- type PreconditionFunc
- type SortableSliceOfMaps
- type SortableSliceOfScalars
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateStrategicMergePatch
deprecated
added in
v1.1.1
func CreateThreeWayMergePatch ¶ added in v1.1.1
func CreateThreeWayMergePatch(original, modified, current []byte, dataStruct interface{}, overwrite bool, fns ...PreconditionFunc) ([]byte, error)
CreateThreeWayMergePatch 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).
func CreateTwoWayMergePatch ¶ added in v1.1.1
func CreateTwoWayMergePatch(original, modified []byte, dataStruct interface{}, fns ...PreconditionFunc) ([]byte, error)
CreateTwoWayMergePatch 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.
func HasConflicts ¶ added in v1.1.1
HasConflicts 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.
func IsConflict ¶ added in v1.1.1
IsConflict returns true if the provided error indicates a conflict between the patch and the current configuration.
func IsPreconditionFailed ¶ added in v1.1.1
IsPreconditionFailed returns true if the provided error indicates a precondition failed.
func MergingMapsHaveConflicts ¶ added in v1.2.0
func MergingMapsHaveConflicts(left, right map[string]interface{}, dataStruct interface{}) (bool, error)
MergingMapsHaveConflicts 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.
func StrategicMergePatch ¶ added in v1.1.1
StrategicMergePatch 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.
func StrategicMergePatchData
deprecated
Types ¶
type PreconditionFunc ¶ added in v1.1.1
type PreconditionFunc func(interface{}) bool
PreconditionFunc asserts that an incompatible change is not present within a patch.
func RequireKeyUnchanged ¶ added in v1.1.1
func RequireKeyUnchanged(key string) PreconditionFunc
RequireKeyUnchanged returns a precondition function that fails if the provided key is present in the patch (indicating that its value has changed).
func RequireMetadataKeyUnchanged ¶ added in v1.5.0
func RequireMetadataKeyUnchanged(key string) PreconditionFunc
RequireMetadataKeyUnchanged creates a precondition function that fails if the metadata.key is present in the patch (indicating its value has changed).
type SortableSliceOfMaps ¶
type SortableSliceOfMaps struct {
// contains filtered or unexported fields
}
func (SortableSliceOfMaps) Len ¶
func (ss SortableSliceOfMaps) Len() int
func (SortableSliceOfMaps) Less ¶
func (ss SortableSliceOfMaps) Less(i, j int) bool
func (SortableSliceOfMaps) Swap ¶
func (ss SortableSliceOfMaps) Swap(i, j int)
type SortableSliceOfScalars ¶
type SortableSliceOfScalars struct {
// contains filtered or unexported fields
}
func (SortableSliceOfScalars) Len ¶
func (ss SortableSliceOfScalars) Len() int
func (SortableSliceOfScalars) Less ¶
func (ss SortableSliceOfScalars) Less(i, j int) bool
func (SortableSliceOfScalars) Swap ¶
func (ss SortableSliceOfScalars) Swap(i, j int)