template

package
v2.19.1-dev.7 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FullStringEscapeFunction = escapeCharactersForJson

FullStringEscapeFunction fully escapes any special characters in the input string, ensure it is valid for use in JSON

Functions

func EscapeSpecialCharactersInValue

func EscapeSpecialCharactersInValue(value interface{}, escapeFunc StringEscapeFunction) (interface{}, error)

EscapeSpecialCharactersInValue takes a value and tries to escape any strings in it - it will walk recursively in case of maps/maps-of-maps of string and escape any special characters using a StringEscapeFunction. This is used by v1 config templating - with a simple function escaping newlines and v2 parameter values returns - with an escape function escaping strings to be fully JSON compliant

func UseGoTemplatesForDoubleCurlyBraces added in v2.19.0

func UseGoTemplatesForDoubleCurlyBraces(src []byte) []byte

UseGoTemplatesForDoubleCurlyBraces replaces each occurrence of "{{" with "{{`{{`}}" and each occurrence of "}}" with "{{`}}`}}". This ensures that when the returned string is used to render templates, e.g. during deployment, the "{{" and "}}" are not misinterpreted.

Types

type StringEscapeFunction

type StringEscapeFunction func(string) (string, error)

Jump to

Keyboard shortcuts

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