template/template.go
func funcMap(i *funcMapInput) template.FuncMap {
	var scratch Scratch

	return template.FuncMap{
		// API functions
		"datacenters":  datacentersFunc(i.brain, i.used, i.missing),
		"file":         fileFunc(i.brain, i.used, i.missing),
		"key":          keyFunc(i.brain, i.used, i.missing),
		"keyExists":    keyExistsFunc(i.brain, i.used, i.missing),
		"keyOrDefault": keyWithDefaultFunc(i.brain, i.used, i.missing),
		"ls":           lsFunc(i.brain, i.used, i.missing),
		"node":         nodeFunc(i.brain, i.used, i.missing),
		"nodes":        nodesFunc(i.brain, i.used, i.missing),
		"secret":       secretFunc(i.brain, i.used, i.missing),
		"secrets":      secretsFunc(i.brain, i.used, i.missing),
		"service":      serviceFunc(i.brain, i.used, i.missing),
		"services":     servicesFunc(i.brain, i.used, i.missing),
		"tree":         treeFunc(i.brain, i.used, i.missing),

		// Scratch
		"scratch": func() *Scratch { return &scratch },

		// Helper functions
		"base64Decode":    base64Decode,
		"base64Encode":    base64Encode,
		"base64URLDecode": base64URLDecode,
		"base64URLEncode": base64URLEncode,
		"byKey":           byKey,
		"byTag":           byTag,
		"contains":        contains,
		"containsAll":     containsSomeFunc(true, true),
		"containsAny":     containsSomeFunc(false, false),
		"containsNone":    containsSomeFunc(true, false),
		"containsNotAll":  containsSomeFunc(false, true),
		"env":             envFunc(i.env),
		"executeTemplate": executeTemplateFunc(i.t),
		"explode":         explode,
		"in":              in,
		"indent":          indent,
		"loop":            loop,
		"join":            join,
		"trimSpace":       trimSpace,
		"parseBool":       parseBool,
		"parseFloat":      parseFloat,
		"parseInt":        parseInt,
		"parseJSON":       parseJSON,
		"parseUint":       parseUint,
		"plugin":          plugin,
		"regexReplaceAll": regexReplaceAll,
		"regexMatch":      regexMatch,
		"replaceAll":      replaceAll,
		"timestamp":       timestamp,
		"toLower":         toLower,
		"toJSON":          toJSON,
		"toJSONPretty":    toJSONPretty,
		"toTitle":         toTitle,
		"toTOML":          toTOML,
		"toUpper":         toUpper,
		"toYAML":          toYAML,
		"split":           split,

		// Math functions
		"add":      add,
		"subtract": subtract,
		"multiply": multiply,
		"divide":   divide,
		"modulo":   modulo,
	}
}
func funcMap(i *funcMapInput) template.FuncMap {
	var scratch Scratch

	return template.FuncMap{
		// API functions
		"datacenters":  datacentersFunc(i.brain, i.used, i.missing),
		"file":         fileFunc(i.brain, i.used, i.missing),
		"key":          keyFunc(i.brain, i.used, i.missing),
		"keyExists":    keyExistsFunc(i.brain, i.used, i.missing),
		"keyOrDefault": keyWithDefaultFunc(i.brain, i.used, i.missing),
		"ls":           lsFunc(i.brain, i.used, i.missing),
		"node":         nodeFunc(i.brain, i.used, i.missing),
		"nodes":        nodesFunc(i.brain, i.used, i.missing),
		"secret":       secretFunc(i.brain, i.used, i.missing),
		"secrets":      secretsFunc(i.brain, i.used, i.missing),
		"service":      serviceFunc(i.brain, i.used, i.missing),
		"services":     servicesFunc(i.brain, i.used, i.missing),
		"tree":         treeFunc(i.brain, i.used, i.missing),

		// Scratch
		"scratch": func() *Scratch { return &scratch },

		// Helper functions
		"base64Decode":    base64Decode,
		"base64Encode":    base64Encode,
		"base64URLDecode": base64URLDecode,
		"base64URLEncode": base64URLEncode,
		"byKey":           byKey,
		"byTag":           byTag,
		"contains":        contains,
		"containsAll":     containsSomeFunc(true, true),
		"containsAny":     containsSomeFunc(false, false),
		"containsNone":    containsSomeFunc(true, false),
		"containsNotAll":  containsSomeFunc(false, true),
		"env":             envFunc(i.env),
		"executeTemplate": executeTemplateFunc(i.t),
		"explode":         explode,
		"in":              in,
		"indent":          indent,
		"loop":            loop,
		"join":            join,
		"trimSpace":       trimSpace,
		"parseBool":       parseBool,
		"parseFloat":      parseFloat,
		"parseInt":        parseInt,
		"parseJSON":       parseJSON,
		"parseUint":       parseUint,
		"plugin":          plugin,
		"regexReplaceAll": regexReplaceAll,
		"regexMatch":      regexMatch,
		"replaceAll":      replaceAll,
		"timestamp":       timestamp,
		"toLower":         toLower,
		"toJSON":          toJSON,
		"toJSONPretty":    toJSONPretty,
		"toTitle":         toTitle,
		"toTOML":          toTOML,
		"toUpper":         toUpper,
		"toYAML":          toYAML,
		"split":           split,

		// Math functions
		"add":      add,
		"subtract": subtract,
		"multiply": multiply,
		"divide":   divide,
		"modulo":   modulo,
	}
}
func funcMap ( i * funcMapInput ) template . FuncMap { var scratch Scratch return template . FuncMap { // API functions " " : datacentersFunc ( i . brain , i . used , i . missing ) , " " : fileFunc ( i . brain , i . used , i . missing ) , " " : keyFunc ( i . brain , i . used , i . missing ) , " " : keyExistsFunc ( i . brain , i . used , i . missing ) , " " : keyWithDefaultFunc ( i . brain , i . used , i . missing ) , " " : lsFunc ( i . brain , i . used , i . missing ) , " " : nodeFunc ( i . brain , i . used , i . missing ) , " " : nodesFunc ( i . brain , i . used , i . missing ) , " " : secretFunc ( i . brain , i . used , i . missing ) , " " : secretsFunc ( i . brain , i . used , i . missing ) , " " : serviceFunc ( i . brain , i . used , i . missing ) , " " : servicesFunc ( i . brain , i . used , i . missing ) , " " : treeFunc ( i . brain , i . used , i . missing ) , // Scratch " " : func ( ) * Scratch { return & scratch } , // Helper functions " " : base64Decode , " " : base64Encode , " " : base64URLDecode , " " : base64URLEncode , " " : byKey , " " : byTag , " " : contains , " " : containsSomeFunc ( true , true ) , " " : containsSomeFunc ( false , false ) , " " : containsSomeFunc ( true , false ) , " " : containsSomeFunc ( false , true ) , " " : envFunc ( i . env ) , " " : executeTemplateFunc ( i . t ) , " " : explode , " " : in , " " : indent , " " : loop , " " : join , " " : trimSpace , " " : parseBool , " " : parseFloat , " " : parseInt , " " : parseJSON , " " : parseUint , " " : plugin , " " : regexReplaceAll , " " : regexMatch , " " : replaceAll , " " : timestamp , " " : toLower , " " : toJSON , " " : toJSONPretty , " " : toTitle , " " : toTOML , " " : toUpper , " " : toYAML , " " : split , // Math functions " " : add , " " : subtract , " " : multiply , " " : divide , " " : modulo , } }
// funcMap is the map of template functions to their respective functions.
funcMap is the map of template functions to their respective functions .