utils

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2025 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

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

func ExtractObjectJMES

func ExtractObjectJMES(old interface{}, pathKey, path string) interface{}

ExtractObjectJMES is used to extract object from old using JMES path

func IsEmptyObject added in v0.2.0

func IsEmptyObject(v interface{}) bool

IsEmptyObject returns true if the input should be considered an empty patch

func LastSegment added in v0.2.0

func LastSegment(input string) string

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 ResponseErrorWasNotFound

func ResponseErrorWasNotFound(err error) bool

func ResponseErrorWasStatusCode

func ResponseErrorWasStatusCode(err error, statusCode int) bool

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

Types

type UpdateJsonOption added in v0.2.0

type UpdateJsonOption struct {
	IgnoreCasing          bool
	IgnoreMissingProperty bool
	IgnoreNullProperty    bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL