unitool

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepCollectChildren

func DeepCollectChildren(source map[string]interface{}, path, key string) (map[string]interface{}, error)

DeepCollectChildren collects params from nesting structures For example: jobs.dev.jobs.install - to collect params from this structure pass path=dev.install and key=jobs.

func DeepCollectParams

func DeepCollectParams(source map[string]interface{}, path, key string) (map[string]interface{}, error)

func DeepCopyMap

func DeepCopyMap(m map[string]interface{}) (map[string]interface{}, error)

DeepCopyMap performs a deep copy of the given map m.

func FormatByExtension

func FormatByExtension(f string) string

func GitClone

func GitClone(url, referenceName, path string, depth int, singleBranch bool) error

func MarshallJSON added in v0.1.3

func MarshallJSON(m interface{}) string

func MarshallYaml

func MarshallYaml(m interface{}) string

func Merge

func Merge(dst, src interface{}, overrideDstStringValues bool) interface{}

TODO: Add merge for lists (initial arguments).

func ReadFile

func ReadFile(filename string) []byte

func RemoveFromList

func RemoveFromList(l []interface{}, item string) []interface{}

func SearchMapWithPathPrefixes

func SearchMapWithPathPrefixes(source map[string]interface{}, path []string) interface{}

searchMapWithPathPrefixes recursively searches for a value for path in source map.

Taken from "viper". While searchMap() considers each path element as a single map key, this function searches for, and prioritizes, merged path elements. e.g., if in the source, "foo" is defined with a sub-key "bar", and "foo.bar" is also defined, this latter value is returned for path ["foo", "bar"].

This should be useful only at config level (other maps may not contain dots in their keys).

Note: This assumes that the path entries and map keys are lower cased.

func SearchMapWithPathStringPrefixes

func SearchMapWithPathStringPrefixes(source map[string]interface{}, path string) interface{}

func StringListContains

func StringListContains(s []string, e string) bool

func UnmarshalByType

func UnmarshalByType(t string, stream []byte) (map[string]interface{}, error)

func UnmarshalJSON added in v0.1.3

func UnmarshalJSON(stream []byte) (map[string]interface{}, error)

func UnmarshalYaml

func UnmarshalYaml(stream []byte) (map[string]interface{}, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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