render

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 21 Imported by: 6 modules, 11 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) Compare added in v0.11.0

func (tpl *Template) Compare(v1, v2 interface{}) bool

func (*Template) Content added in v0.9.11

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

func (*Template) DateParse added in v0.13.1

func (tpl *Template) DateParse(d string) (time.Time, 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) FindKey added in v0.11.0

func (tpl *Template) FindKey(obj interface{}, field string, value interface{}) interface{}

func (*Template) FindKeys added in v0.11.0

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

func (*Template) FindObjectByField added in v0.11.0

func (tpl *Template) FindObjectByField(obj interface{}, field string, value interface{}) interface{}

func (*Template) FromJson added in v0.10.4

func (tpl *Template) FromJson(i interface{}) (interface{}, 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) GoogleCalendarDeleteEvents added in v0.13.2

func (tpl *Template) GoogleCalendarDeleteEvents(params map[string]interface{}) ([]byte, error)

func (*Template) GoogleCalendarGetEvents added in v0.13.2

func (tpl *Template) GoogleCalendarGetEvents(params map[string]interface{}) ([]byte, error)

func (*Template) GoogleCalendarInsertEvent added in v0.13.2

func (tpl *Template) GoogleCalendarInsertEvent(params map[string]interface{}) ([]byte, error)

func (*Template) HttpGet added in v0.10.4

func (tpl *Template) HttpGet(params map[string]interface{}) ([]byte, error)

url, contentType, authorization string, timeout int

func (*Template) HttpPost added in v0.13.0

func (tpl *Template) HttpPost(params map[string]interface{}) ([]byte, 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(v interface{}) (bool, error)

func (*Template) JiraCreateIssue added in v0.13.1

func (tpl *Template) JiraCreateIssue(params map[string]interface{}) ([]byte, error)

func (*Template) JiraSearchAssets added in v0.12.0

func (tpl *Template) JiraSearchAssets(params map[string]interface{}) ([]byte, 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) PagerDutyCreateIncident added in v0.12.1

func (tpl *Template) PagerDutyCreateIncident(params map[string]interface{}) ([]byte, error)

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) RegexMatchFindKey added in v0.11.0

func (tpl *Template) RegexMatchFindKey(obj interface{}, field, value string) interface{}

func (*Template) RegexMatchFindKeys added in v0.11.0

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

func (*Template) RegexMatchObjectByField added in v0.9.11

func (tpl *Template) RegexMatchObjectByField(obj 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) Sleep added in v0.13.2

func (tpl *Template) Sleep(ms int) error

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) TemplateRenderFile added in v0.12.2

func (tpl *Template) TemplateRenderFile(path string, obj interface{}) (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.10.4

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
	FilterFuncs bool
}

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