Documentation
¶
Index ¶
- func CreateFuncs(ctx context.Context) template.FuncMap
- func GetCelEnv(environment map[string]any) []cel.EnvOption
- func LoadSharedLibrary(source string) error
- func RegisterType(i any)
- func RunExpression(_environment map[string]any, template Template) (any, error)
- func RunExpressionContext(ctx commonsContext.Context, _environment map[string]any, template Template) (any, error)
- func RunTemplate(environment map[string]any, template Template) (string, error)
- func RunTemplateBool(environment map[string]any, template Template) (bool, error)
- func RunTemplateContext(ctx commonsContext.Context, environment map[string]any, template Template) (string, error)
- func Serialize(in map[string]any) (map[string]any, error)
- type AsMapper
- type Delims
- type MetricsType
- type StructTemplater
- type Template
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFuncs ¶
CreateFuncs - function mappings are created here
func LoadSharedLibrary ¶ added in v3.20.4
LoadSharedLibrary loads a shared library for Otto
func RegisterType ¶ added in v3.20.24
func RegisterType(i any)
func RunExpression ¶ added in v3.20.19
func RunExpressionContext ¶ added in v3.24.30
func RunTemplate ¶ added in v3.20.4
func RunTemplateBool ¶ added in v3.24.33
func RunTemplateContext ¶ added in v3.24.30
Types ¶
type MetricsType ¶
type MetricsType struct { // times for rendering each template RenderDuration map[string]time.Duration // time it took to gather templates GatherDuration time.Duration // time it took to render all templates TotalRenderDuration time.Duration TemplatesGathered int TemplatesProcessed int Errors int }
MetricsType - Warning: experimental! This may change in breaking ways without warning. This is not subject to any semantic versioning guarantees!
var Metrics *MetricsType
Metrics tracks interesting basic metrics around gomplate executions. Warning: experimental! This may change in breaking ways without warning. This is not subject to any semantic versioning guarantees!
type StructTemplater ¶ added in v3.20.23
type StructTemplater struct { Context context.Context Values map[string]interface{} // IgnoreFields from walking where key is field name and value is field type IgnoreFields map[string]string Funcs map[string]any DelimSets []Delims // If specified create a function for each value so that is can be accessed via {{ value }} in addition to {{ .value }} ValueFunctions bool RequiredTag string }
func (StructTemplater) Struct ¶ added in v3.20.23
func (w StructTemplater) Struct(reflect.Value) error
this func is required to fulfil the reflectwalk.StructWalker interface
func (StructTemplater) StructField ¶ added in v3.20.23
func (w StructTemplater) StructField(f reflect.StructField, v reflect.Value) error
func (StructTemplater) Template ¶ added in v3.20.23
func (w StructTemplater) Template(val string) (string, error)
func (StructTemplater) Walk ¶ added in v3.20.23
func (w StructTemplater) Walk(object interface{}) error
type Template ¶ added in v3.20.4
type Template struct { Template string `yaml:"template,omitempty" json:"template,omitempty"` // Go template JSONPath string `yaml:"jsonPath,omitempty" json:"jsonPath,omitempty"` Expression string `yaml:"expr,omitempty" json:"expr,omitempty"` // A cel-go expression Javascript string `yaml:"javascript,omitempty" json:"javascript,omitempty"` RightDelim string `yaml:"-" json:"-"` LeftDelim string `yaml:"-" json:"-"` // Pass in additional cel-env options like functions // that aren't simple enough to be included in Functions CelEnvs []cel.EnvOption `yaml:"-" json:"-"` // A map of functions that are accessible to cel expressions // and go templates. // NOTE: For cel expressions, the functions must be of type func() any. // If any other function type is used, an error will be returned. // Opt to CelEnvs for those cases. Functions map[string]any `yaml:"-" json:"-"` }
func (Template) IsCacheable ¶ added in v3.24.0
func (Template) ShortString ¶ added in v3.24.30
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package base64 contains Base64 encoding/decoding functions
|
Package base64 contains Base64 encoding/decoding functions |
Package coll contains functions to help manipulate and query collections of data, like slices/arrays and maps.
|
Package coll contains functions to help manipulate and query collections of data, like slices/arrays and maps. |
Package conv contains functions that help converting data between different types
|
Package conv contains functions that help converting data between different types |
Package data contains functions that parse and produce data structures in different formats.
|
Package data contains functions that parse and produce data structures in different formats. |
Package funcs is an internal package that provides gomplate namespaces and functions to be used in 'text/template' templates.
|
Package funcs is an internal package that provides gomplate namespaces and functions to be used in 'text/template' templates. |
internal
|
|
Package math contains set of basic math functions to be able to perform simple arithmetic operations
|
Package math contains set of basic math functions to be able to perform simple arithmetic operations |
Package random contains functions for generating random values
|
Package random contains functions for generating random values |
Package regexp contains functions for dealing with regular expressions
|
Package regexp contains functions for dealing with regular expressions |
Package duration contains routines to parse standard units of time.
|
Package duration contains routines to parse standard units of time. |
Package test contains functions to help validate assumptions and can cause template generation to fail in specific cases
|
Package test contains functions to help validate assumptions and can cause template generation to fail in specific cases |
Package time contains functions to help work with date and time
|
Package time contains functions to help work with date and time |
Package tmpl contains functions for defining or executing in-line templates.
|
Package tmpl contains functions for defining or executing in-line templates. |
Click to show internal directories.
Click to hide internal directories.