template

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New added in v0.9.0

func New() *render

func Render

func Render(name, templateStr string, variable any, funcMaps ...template.FuncMap) (string, error)

func RenderForFile

func RenderForFile(name, tplFileName, dstFileName string, variable any) error

Types

type ContentGetter added in v0.9.0

type ContentGetter func() ([]byte, error)

ContentGetter gets content from any source

func FromContent added in v0.9.0

func FromContent(content string) ContentGetter

func FromLocalFile added in v0.9.0

func FromLocalFile(filepath string) ContentGetter

func FromURL added in v0.9.0

func FromURL(url string) ContentGetter

type Processor added in v0.9.0

type Processor func([]byte) ([]byte, error)

Processor process content before render

func AddDotForVariablesInConfigProcessor added in v0.9.0

func AddDotForVariablesInConfigProcessor() Processor

func AddQuoteForVariablesInConfigProcessor added in v0.10.1

func AddQuoteForVariablesInConfigProcessor() Processor

type RenderFunc added in v0.9.0

type RenderFunc func([]byte) (string, error)

RenderFunc render content to string

func DefaultRender added in v0.9.0

func DefaultRender(templateName string, vars any, funcMaps ...template.FuncMap) RenderFunc

Jump to

Keyboard shortcuts

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