render

package
v0.9.11 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 21 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HtmlTemplate

type HtmlTemplate struct {
	Template
	// contains filtered or unexported fields
}

func NewHtmlTemplate

func NewHtmlTemplate(options TemplateOptions, logger common.Logger) (*HtmlTemplate, error)

func (*HtmlTemplate) CustomRenderWithOptions added in v0.4.5

func (tpl *HtmlTemplate) CustomRenderWithOptions(opts TemplateOptions) ([]byte, error)

func (*HtmlTemplate) Render added in v0.4.5

func (tpl *HtmlTemplate) Render() ([]byte, error)

func (*HtmlTemplate) RenderObject added in v0.4.6

func (tpl *HtmlTemplate) RenderObject(obj interface{}) ([]byte, error)

type Template

type Template struct {
	// contains filtered or unexported fields
}

func (*Template) Content added in v0.9.11

func (tpl *Template) Content(s string) (string, error)

func (*Template) Env added in v0.9.11

func (tpl *Template) Env(key string) (string, error)

func (*Template) EscapeString added in v0.9.11

func (tpl *Template) EscapeString(s string) (string, error)

func (*Template) GitlabPipelineVars added in v0.9.11

func (tpl *Template) GitlabPipelineVars(URL string, token string, projectID int, query string, limit int) string

func (*Template) Gjson added in v0.9.11

func (tpl *Template) Gjson(obj interface{}, path string) (string, error)

func (*Template) IfDef added in v0.9.11

func (tpl *Template) IfDef(i interface{}, def string) (string, error)

func (*Template) IfElse added in v0.9.11

func (tpl *Template) IfElse(o interface{}, vars []interface{}) interface{}

func (*Template) IfIP added in v0.9.11

func (tpl *Template) IfIP(obj interface{}) bool

func (*Template) IfIPAndPort added in v0.9.11

func (tpl *Template) IfIPAndPort(obj interface{}) bool

func (*Template) IsEmpty added in v0.9.11

func (tpl *Template) IsEmpty(s string) (bool, error)

func (*Template) Join added in v0.9.11

func (tpl *Template) Join(sep string, a []string) (string, error)

join is a version of strings.Join that can be piped

func (*Template) JsonEscape added in v0.9.11

func (tpl *Template) JsonEscape(s string) (string, error)

func (*Template) Jsonata added in v0.9.11

func (tpl *Template) Jsonata(data interface{}, query string) (string, error)

func (*Template) LogDebug added in v0.9.11

func (tpl *Template) LogDebug(obj interface{}, args ...interface{}) (string, error)

put warnings to logger

func (*Template) LogError added in v0.9.11

func (tpl *Template) LogError(obj interface{}, args ...interface{}) (string, error)

put errors to logger

func (*Template) LogInfo added in v0.9.11

func (tpl *Template) LogInfo(obj interface{}, args ...interface{}) (string, error)

put information to logger

func (*Template) LogWarn added in v0.9.11

func (tpl *Template) LogWarn(obj interface{}, args ...interface{}) (string, error)

put warnings to logger

func (*Template) RegexFindSubmatch added in v0.9.11

func (tpl *Template) RegexFindSubmatch(regex string, s string) []string

func (*Template) RegexMatch added in v0.9.11

func (tpl *Template) RegexMatch(re, s string) (bool, error)

regexMatch returns true or alse if the string matches the given regular expression

func (*Template) RegexMatchObjectByField added in v0.9.11

func (tpl *Template) RegexMatchObjectByField(obj map[string]interface{}, ield, value string) interface{}

func (*Template) RegexMatchObjectNameByField added in v0.9.11

func (tpl *Template) RegexMatchObjectNameByField(obj map[string]interface{}, ield, value string) interface{}

func (*Template) RegexMatchObjectNamesByField added in v0.9.10

func (tpl *Template) RegexMatchObjectNamesByField(obj map[string]interface{}, field, value string) []interface{}

func (*Template) RegexReplaceAll added in v0.9.11

func (tpl *Template) RegexReplaceAll(re, pl, s string) (string, error)

regexReplaceAll replaces all occurrences of a regular expression with the given replacement value.

func (*Template) ReplaceAll added in v0.9.11

func (tpl *Template) ReplaceAll(f, t, s string) (string, error)

replaceAll replaces all occurrences of a value in a string with the given replacement value.

func (*Template) Split added in v0.9.11

func (tpl *Template) Split(sep, s string) ([]string, error)

split is a version of strings.Split that can be piped

func (*Template) TagExists added in v0.9.11

func (tpl *Template) TagExists(s, key string) (bool, error)

func (*Template) TagValue added in v0.9.11

func (tpl *Template) TagValue(s, key string) (string, error)

func (*Template) TimeFormat added in v0.9.11

func (tpl *Template) TimeFormat(s string, format string) (string, error)

func (*Template) TimeNano added in v0.9.11

func (tpl *Template) TimeNano(s string) (string, error)

func (*Template) ToJSON added in v0.9.11

func (tpl *Template) ToJSON(i interface{}) (string, error)

toJSON converts the given structure into a deeply nested JSON string.

func (*Template) ToLower added in v0.9.11

func (tpl *Template) ToLower(s string) (string, error)

toLower converts the given string (usually by a pipe) to lowercase.

func (*Template) ToString added in v0.9.11

func (tpl *Template) ToString(i interface{}) (string, error)

toString converts the given value to string

func (*Template) ToTitle added in v0.9.11

func (tpl *Template) ToTitle(s string) (string, error)

toTitle converts the given string (usually by a pipe) to titlecase.

func (*Template) ToUpper added in v0.9.11

func (tpl *Template) ToUpper(s string) (string, error)

toUpper converts the given string (usually by a pipe) to uppercase.

func (*Template) URLWait added in v0.9.11

func (tpl *Template) URLWait(url string, timeout, retry int, size int64) []byte

func (*Template) UnescapeString added in v0.9.11

func (tpl *Template) UnescapeString(s string) (string, error)

type TemplateOptions

type TemplateOptions struct {
	Name       string
	Object     string
	Content    string
	Files      []string
	TimeFormat string
	Pattern    string
	Funcs      map[string]any
}

type TextTemplate

type TextTemplate struct {
	Template
	// contains filtered or unexported fields
}

func NewTextTemplate

func NewTextTemplate(options TemplateOptions, logger common.Logger) (*TextTemplate, error)

func (*TextTemplate) CustomRenderWithOptions added in v0.4.5

func (tpl *TextTemplate) CustomRenderWithOptions(opts TemplateOptions) ([]byte, error)

func (*TextTemplate) Render added in v0.4.5

func (tpl *TextTemplate) Render() ([]byte, error)

func (*TextTemplate) RenderObject added in v0.4.6

func (tpl *TextTemplate) RenderObject(obj interface{}) ([]byte, error)

Jump to

Keyboard shortcuts

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