Documentation
¶
Index ¶
- func CompareMaps(existing, new map[string]string) bool
- func CompareStructNumTypeAgnostic(src, dst any) bool
- func ExtractPath(data any, path []string) (any, bool, error)
- func MergeMaps(existing, new map[string]string) map[string]string
- func NewWorkQueue(queueName string) workqueue.TypedRateLimitingInterface[interface{}]
- func OptionalString(ptr any) string
- func RemovePaths(m map[string]any, excludedPaths []string, pathSeparator string)
- func StructToStruct(src any, dst any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareMaps ¶ added in v0.9.0
func CompareStructNumTypeAgnostic ¶ added in v0.13.0
CompareStructNumTypeAgnostic compares two structs, ignoring the type of numbers (e.g., int, float32, float64) and treating them as equal if their values are equal.
func ExtractPath ¶ added in v0.8.0
ExtractPath extracts the fields specified by the path (given as slice of strings) from the given data.
The function takes two arguments:
- data: The input data, which can be a map, a slice, or a nested combination of both.
- path: A slice of strings representing the path to the desired fields.
It returns three values:
- any: The extracted data, which can be a map, a slice, or a single value (including nil).
- bool: A boolean indicating whether last field in the path is a map.
- error: An error if any occurred during the extraction process.
The function works by recursively traversing the input data according to the provided path. It handles maps and slices, extracting the corresponding values at each level. If the path leads to a value that is neither a map nor a slice, it returns that value.
func NewWorkQueue ¶ added in v0.2.0
func NewWorkQueue(queueName string) workqueue.TypedRateLimitingInterface[interface{}]
func OptionalString ¶ added in v0.13.0
take any pointer passed in and print "nil" if it's nil, and otherwise the value (convenience function for logging)
func RemovePaths ¶ added in v0.7.0
RemovePaths removes all of the excludedPaths passed in from m, where each excludedPath is a string representation of the path, demarcated by pathSeparator
func StructToStruct ¶ added in v0.2.0
StructToStruct converts a struct type (src) into another (dst)
Types ¶
This section is empty.