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{} with only changed fields for objects - a full new array for arrays when they differ - the new primitive value for scalars when they differ
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