templates

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFuncMap

func GetFuncMap() template.FuncMap

GetFuncMap returns a Map of template functions

func TmplArray

func TmplArray(path string, input interface{}) []interface{}

TmplArray parses a YAML path in the input parameter as an array. If variable found is an array, array values are returned If variable found is a map, the maps values are returned If none of above then nil is returned

func TmplFileExists

func TmplFileExists(filePath string) bool

func TmplFromYaml

func TmplFromYaml(str string) map[string]interface{}

TmplFromYaml converts a YAML document into a map[string]interface{}.

This is not a general-purpose YAML parser, and will not parse all valid YAML documents. Additionally, because its intended use is within templates it tolerates errors. It will insert the returned error message string into m["Error"] in the returned map.

Borrowed from github.com/helm/helm/pkg/chartutil

func TmplGet

func TmplGet(path string, input interface{}) interface{}

TODO: Add description

func TmplGetFileContent

func TmplGetFileContent(filePath string) string

func TmplGetFiles

func TmplGetFiles(directoryPath string) []os.FileInfo

func TmplInt

func TmplInt(path string, input interface{}) int

TODO: Add description

func TmplIs

func TmplIs(a interface{}, b interface{}) bool

func TmplIsnt

func TmplIsnt(a interface{}, b interface{}) bool

func TmplRightPad added in v0.9.0

func TmplRightPad(s string, padding int) string

TmplRightPad adds padding to the right of a string.

func TmplStrConst

func TmplStrConst(value string) string

template function to convert from log.debug to LOG_DEBUG

func TmplString

func TmplString(path string, input interface{}) string

TODO: Add description

func TmplToYaml

func TmplToYaml(v interface{}) string

TmplToYaml takes an interface, marshals it to yaml, and returns a string. It will always return a string, even on marshal error (empty string).

This is designed to be called from a template.

Borrowed from github.com/helm/helm/pkg/chartutil

func TmplUpperFirst added in v0.9.0

func TmplUpperFirst(s string) string

TmplUpperFirst upper cases the first letter in the string

Types

type KeyValuePair

type KeyValuePair struct {
	Key   string
	Value interface{}
}

func TmplObjectArray

func TmplObjectArray(path string, input interface{}) []KeyValuePair

TmplObjectArray parses a YAML path in the input parameter as an object and returns Key & Value pairs. If variable found is a map, a []KeyValuePair array is returned If variable found is a map, the maps values are returned If none of above then nil is returned

Jump to

Keyboard shortcuts

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