Documentation ¶
Index ¶
- func AddPrefix(prefix, input string) string
- func LoadFuncMap() template.FuncMap
- func Render(ctx context.Context, client http.Client, tmpl string, payload interface{}) (string, error)
- func RenderTrim(ctx context.Context, client http.Client, tmpl string, playload interface{}) (string, error)
- func ToSentence(s string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPrefix ¶ added in v1.2.0
AddPrefix prepends the prefix string to the input string if the input string does not already have the prefix. It trims any leading or trailing space from the input before checking for the prefix.
func LoadFuncMap ¶ added in v1.3.0
LoadFuncMap merges the sprig template functions with any custom functions provided, giving priority to the custom functions in case of collisions.
func Render ¶
func Render(ctx context.Context, client http.Client, tmpl string, payload interface{}) (string, error)
Render parses and executes a template, returning the results in string format. Trailing or leading spaces or new-lines are not getting truncated. It is able to read templates from remote paths, local files or directly from the string.
func RenderTrim ¶
func RenderTrim(ctx context.Context, client http.Client, tmpl string, playload interface{}) (string, error)
RenderTrim parses and executes a template, returning the results in string format. The result is trimmed to remove left and right padding and newlines that may be added unintentially in the template markup.
func ToSentence ¶ added in v1.5.0
ToSentence capitalizes the first letter of the input string, adds a period at the end if needed, and returns the resulting sentence.
Types ¶
This section is empty.