util

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareMaps added in v0.9.0

func CompareMaps(existing, new map[string]string) bool

func ExtractPath added in v0.8.0

func ExtractPath(data any, path []string) (any, bool, error)

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 MergeMaps added in v0.9.0

func MergeMaps(existing, new map[string]string) map[string]string

func NewWorkQueue added in v0.2.0

func NewWorkQueue(queueName string) workqueue.TypedRateLimitingInterface[interface{}]

func RemovePaths added in v0.7.0

func RemovePaths(m map[string]any, excludedPaths []string, pathSeparator string)

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

func StructToStruct(src any, dst any) error

StructToStruct converts a struct type (src) into another (dst)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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