fieldpath

package
v1.13.2-k3s1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractFieldPathAsString

func ExtractFieldPathAsString(obj interface{}, fieldPath string) (string, error)

ExtractFieldPathAsString extracts the field from the given object and returns it as a string. The object must be a pointer to an API type.

func FormatMap

func FormatMap(m map[string]string) (fmtStr string)

FormatMap formats map[string]string to a string.

func SplitMaybeSubscriptedPath

func SplitMaybeSubscriptedPath(fieldPath string) (string, string, bool)

SplitMaybeSubscriptedPath checks whether the specified fieldPath is subscripted, and

  • if yes, this function splits the fieldPath into path and subscript, and returns (path, subscript, true).
  • if no, this function returns (fieldPath, "", false).

Example inputs and outputs:

  • "metadata.annotations['myKey']" --> ("metadata.annotations", "myKey", true)
  • "metadata.annotations['a[b]c']" --> ("metadata.annotations", "a[b]c", true)
  • "metadata.labels[”]" --> ("metadata.labels", "", true)
  • "metadata.labels" --> ("metadata.labels", "", false)

Types

This section is empty.

Jump to

Keyboard shortcuts

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