Documentation
¶
Index ¶
- func DiffObject(old interface{}, new interface{}, option UpdateJsonOption) interface{}
- func ExtractObjectJMES(old interface{}, pathKey, path string) interface{}
- func LastSegment(input string) string
- func MergeObject(old interface{}, new interface{}) interface{}
- func NormalizeJson(input interface{}) string
- func ResponseErrorWasNotFound(err error) bool
- func ResponseErrorWasStatusCode(err error, statusCode int) bool
- func UpdateObject(old interface{}, new interface{}, option UpdateJsonOption) interface{}
- type UpdateJsonOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiffObject ¶ added in v0.2.0
func DiffObject(old interface{}, new interface{}, option UpdateJsonOption) interface{}
DiffObject computes a minimal patch that transforms old -> new. It returns: - nil if there are no changes - a map[string]interface{} listing every changed top-level property in full - the new value itself for arrays and scalars when they differ
Changed values are never partially diffed. RFC 7396 would merge a nested object, but some Graph endpoints replace a complex type wholesale, resetting omitted sub-fields to their defaults (issue #137: patching claimsMatchingExpression.value reset languageVersion).
Special handling: OData metadata fields (keys starting with "@odata.") are always included in the result when they exist in the new object and there are other changes. This is required for Microsoft Graph API endpoints that use polymorphic types and need the discriminator field (@odata.type) to be present in PATCH requests.
func ExtractObjectJMES ¶
func ExtractObjectJMES(old interface{}, pathKey, path string) interface{}
ExtractObjectJMES is used to extract object from old using JMES path
func LastSegment ¶ added in v0.2.0
func MergeObject ¶
func MergeObject(old interface{}, new interface{}) interface{}
MergeObject is used to merge object old and new, if overlaps, use new value
func NormalizeJson ¶
func NormalizeJson(input interface{}) string
func UpdateObject ¶ added in v0.2.0
func UpdateObject(old interface{}, new interface{}, option UpdateJsonOption) interface{}
UpdateObject is used to get an updated object which has same schema as old, but with new value