template

package
v3.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPrefix

func AddPrefix(prefix, input string) string

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

func LoadFuncMap() template.FuncMap

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

func ToSentence(s string) string

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.

Jump to

Keyboard shortcuts

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