template

package
v0.0.0-...-3645f34 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const TemplateToken = "{{"

Variables

View Source
var Functions template.FuncMap

Functions

func Lines

func Lines(s []string) string

Lines joins the given slice using a newline as delimiter

func NetHost

func NetHost(hostport string) string

NetHost returns the host result from net.SplitHostPort. Any error is discarded and an empty string is returned instead

func NetPort

func NetPort(hostport string) int

NetPort returns the port result from net.SplitHostPort. The value is additionally parsed and transformed into a numeric value. Any error is discarded and zero is returned instead

func ReadFile

func ReadFile(f string) string

ReadFile returns the content of the given file as string. Any error is discarded and an empty string is returned instead

Types

type TemplateCache

type TemplateCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewFuncMapTemplateCache

func NewFuncMapTemplateCache(m template.FuncMap) *TemplateCache

func NewTemplateCache

func NewTemplateCache(factory func(string) *template.Template) *TemplateCache

func (*TemplateCache) Flush

func (c *TemplateCache) Flush()

func (*TemplateCache) RenderBool

func (c *TemplateCache) RenderBool(i, b string, ctx interface{}) (bool, error)

func (*TemplateCache) RenderString

func (c *TemplateCache) RenderString(i, s string, ctx interface{}) (string, error)

Jump to

Keyboard shortcuts

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