Documentation
¶
Overview ¶
Package renderer implements data-driven templates for generating textual output
The renderer extends the standard golang text/template and sprig functions.
Templates are executed by applying them to a data structure (configuration). Values in the template refer to elements of the data structure (typically a field of a struct or a key in a map).
Actions can be combined using UNIX-like pipelines.
The input text for a template is UTF-8-encoded text in any format.
See renderer.ExtraFunctions for our custom functions.
Detailed documentation on the syntax and available functions can be found here:
Index ¶
- func ExtraFunctions() template.FuncMap
- func Gzip(input interface{}) (string, error)
- func MergeFunctions(dst *template.FuncMap, src template.FuncMap) error
- func ToYaml(marshallable interface{}) (string, error)
- func Ungzip(input interface{}) (string, error)
- func WithCryptFunctions() func(*config.Config)
- func WithDelim(left, right string) func(*config.Config)
- func WithExtraFunctions() func(*config.Config)
- func WithFunctions(extraFunctions template.FuncMap) func(*config.Config)
- func WithMoreFunctions(moreFunctions template.FuncMap) func(*config.Config)
- func WithMoreParameters(extraParams ...map[string]interface{}) func(*config.Config)
- func WithOptions(options ...string) func(*config.Config)
- func WithParameters(parameters map[string]interface{}) func(*config.Config)
- func WithSprigFunctions() func(*config.Config)
- type Renderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtraFunctions ¶ added in v0.0.6
ExtraFunctions provides additional template functions to the standard (text/template) ones:
- toYaml - provides a configuration data structure fragment as a YAML format
- gzip - use gzip compression inside the templates, for best results use with b64enc
- ungzip - use gzip extraction inside the templates, for best results use with b64dec
func MergeFunctions ¶ added in v0.0.6
MergeFunctions merges two template.FuncMap instances, overrides if necessary
func ToYaml ¶ added in v0.0.4
ToYaml is a template function, it turns a marshallable structure into a YAML fragment
func WithCryptFunctions ¶ added in v0.0.6
WithCryptFunctions mutates Renderer configuration by merging the Crypt template functions
func WithDelim ¶ added in v0.0.6
WithDelim mutates Renderer configuration by replacing the left and right delimiters
func WithExtraFunctions ¶ added in v0.0.6
WithExtraFunctions mutates Renderer configuration by merging the custom template functions
func WithFunctions ¶ added in v0.0.6
WithFunctions mutates Renderer configuration by replacing the template functions
func WithMoreFunctions ¶ added in v0.0.6
WithMoreFunctions mutates Renderer configuration by merging the given template functions,
func WithMoreParameters ¶ added in v0.0.8
WithMoreParameters mutates Renderer configuration by merging the given template parameters
func WithOptions ¶ added in v0.0.6
WithOptions mutates Renderer configuration by replacing the template functions
func WithParameters ¶ added in v0.0.6
WithParameters mutates Renderer configuration by replacing all template parameters
func WithSprigFunctions ¶ added in v0.0.6
WithSprigFunctions mutates Renderer configuration by merging the Sprig template functions
Types ¶
Directories
¶
Path | Synopsis |
---|---|
Package parameters defines data structure for the data-driven renderer Parameters is a tree structure and can be created from a YAML files or 'key=value' pairs.
|
Package parameters defines data structure for the data-driven renderer Parameters is a tree structure and can be created from a YAML files or 'key=value' pairs. |