template

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDotForVariablesInConfigProcessor added in v0.9.0

func AddDotForVariablesInConfigProcessor(bytes []byte) []byte

AddDotForVariablesInConfigProcessor will add dot before varName this is because our variables' syntax is [[ varName ]] while Go's template is [[ .varName ]]

func AddQuoteForVariablesInConfigProcessor added in v0.10.1

func AddQuoteForVariablesInConfigProcessor(bytes []byte) []byte

AddQuoteForVariablesInConfigProcessor will add quote for special varName When [[ ]] has two words and the first word don't contain quota, add quotes to the second word e.g. [[ env GITHUB_TOKEN]] -> [[ env "GITHUB_TOKEN" ]] [[ env 'GITHUB_TOKEN' ]] -> do nothing [[ env "GITHUB_TOKEN" ]] -> do nothing [[ "env" "GITHUB_TOKEN" ]] -> do nothing [[ GITHUB_TOKEN ]] -> do nothing

func ContentGetter added in v0.9.0

func ContentGetter(content string) ([]byte, error)

ContentGetter get content bytes from input content

func LocalFileGetter added in v0.10.3

func LocalFileGetter(filepath string) ([]byte, error)

LocalFileGetter get content bytes from file

func URLGetter added in v0.10.3

func URLGetter(url string) ([]byte, error)

URLGetter get content bytes from remote url

Types

type RenderAPI added in v0.10.3

type RenderAPI interface {
	Render(inputStr string, variables any) (string, error)
}

RenderAPI is a interface with render methods

func NewRenderClient added in v0.10.3

func NewRenderClient(clientOption *TemplateOption, getter getFunc, processors ...processFunc) RenderAPI

NewRenderClient create template render client with template option, getter and processors

type TemplateOption added in v0.10.3

type TemplateOption struct {
	Name               string
	IgnoreMissKeyError bool
	FuncMap            template.FuncMap
}

TemplateOption is used to config template option

Jump to

Keyboard shortcuts

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