Documentation ¶
Index ¶
- Constants
- func AddPackageSpecificTemplateFunctions(tmpl *template.Template) *template.Template
- func ChainTemplatesFromDir(parentTemplate *template.Template, templatesDirPath string) (*template.Template, int, error)
- func ExecuteNamedTemplate(tmpl *template.Template, templateName string, values interface{}) ([]byte, error)
- func ExecuteTemplate(tmpl *template.Template, values interface{}) ([]byte, error)
- func FromYamlFunc(yamlString string) (*types.GenericMap, error)
- func GetGlobalFuncMap() map[string]interface{}
- func GetIncludeFunc(tmpl *template.Template) interface{}
- func GetPackageFuncMap(tmpl *template.Template) map[string]interface{}
- func GetTemplateFromFile(parentTemplate *template.Template, templateName string, filePath string) (*template.Template, error)
- func GetTemplatesFromDir(parentTemplate *template.Template, templatesDirPath string) ([]*template.Template, error)
- func IndexFunc(data interface{}, keys ...string) (interface{}, error)
- func NewRootTemplate() *template.Template
- func ToYamlFunc(value interface{}) (string, error)
Constants ¶
const FuncNameFromYaml = "fromYaml"
FuncNameFromYaml is the name of the template function which converts yaml strings to objects.
const FuncNameInclude = "include"
FuncNameInclude is the name of the "include" template function.
const FuncNameIndex = "index"
FuncNameIndex is the name of the "index" template function.
const FuncNameToYaml = "toYaml"
FuncNameToYaml is the name of the template function which converts objects to yaml strings.
Variables ¶
This section is empty.
Functions ¶
func AddPackageSpecificTemplateFunctions ¶
AddPackageSpecificTemplateFunctions adds the package-specific template functions for the given template.
func ChainTemplatesFromDir ¶
func ChainTemplatesFromDir(parentTemplate *template.Template, templatesDirPath string) (*template.Template, int, error)
ChainTemplatesFromDir returns a single template which contains all of the templates that were found in the given directory.
func ExecuteNamedTemplate ¶
func ExecuteNamedTemplate(tmpl *template.Template, templateName string, values interface{}) ([]byte, error)
ExecuteNamedTemplate executes a named template that can be found in the provided template.
func ExecuteTemplate ¶
ExecuteTemplate executes a template given the template object and the values.
func FromYamlFunc ¶
func FromYamlFunc(yamlString string) (*types.GenericMap, error)
FromYamlFunc converts yaml strings to objects.
func GetGlobalFuncMap ¶
func GetGlobalFuncMap() map[string]interface{}
GetGlobalFuncMap returns the template functions which can be used in any context.
func GetIncludeFunc ¶
GetIncludeFunc creates a new instance of the Include function, which allows helper templates to be executed so their output can be used in other functions.
func GetPackageFuncMap ¶
GetPackageFuncMap returns the template functions which can be used only in the context of a particular template. If the template provided is nil, placeholder template functions are provided which return "Not implemented" errors.
func GetTemplateFromFile ¶
func GetTemplateFromFile(parentTemplate *template.Template, templateName string, filePath string) (*template.Template, error)
GetTemplateFromFile returns a new template object given a template file.
func GetTemplatesFromDir ¶
func GetTemplatesFromDir(parentTemplate *template.Template, templatesDirPath string) ([]*template.Template, error)
GetTemplatesFromDir returns an array containing all of the templates found in the given directory.
func IndexFunc ¶
IndexFunc gets a single value from a generic map (of any depth), given an ordered list of keys.
func NewRootTemplate ¶
NewRootTemplate returns a new root template with options and functions provided.
func ToYamlFunc ¶
ToYamlFunc converts objects to yaml strings.
Types ¶
This section is empty.