templater

package
v0.0.0-...-5a1439f Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomFunctions = template.FuncMap{
	"exists":      exists,
	"findFiles":   findFiles,
	"mapPrintF":   mapPrintF,
	"listString":  listString,
	"isSet":       isSet,
	"removeEmpty": removeEmpty,
}

Functions

func IterativelyTemplate

func IterativelyTemplate(vars map[string]interface{}) (map[string]interface{}, error)

Iterate over the input variables trying to replace data as if it was a template. Keep iterating up to a maximum number of times, or until the size of the input and output remain the same. Doing this allows us to define intermediate variables or aliases (e.g. set `cluster_name` = '{{ .stack.region }}-{{ .stack.account }}' then just use '{{ .kapp.vars.cluster_name }}'. Templating this requires 2 iterations).

func RenderTemplate

func RenderTemplate(inputTemplate string, vars map[string]interface{}) (string, error)

Returns a template rendered with the given input variables

func TemplateFile

func TemplateFile(src string, outBuf *bytes.Buffer, vars map[string]interface{}) error

Renders a template from a template file to a buffer

func TemplateString

func TemplateString(src string, outBuf *bytes.Buffer, vars map[string]interface{}) error

Renders a template into a buffer

Types

This section is empty.

Jump to

Keyboard shortcuts

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