render

package
v0.15.14 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 23 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) CountOccurrences added in v0.15.10

func (tpl *Template) CountOccurrences(list []interface{}) map[string]int

func (*Template) DateParse added in v0.13.1

func (tpl *Template) DateParse(d string) (time.Time, error)

func (*Template) DurationBetween added in v0.15.11

func (tpl *Template) DurationBetween(start, end time.Time) map[string]int

func (*Template) Env added in v0.9.11

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

func (*Template) Error added in v0.14.13

func (tpl *Template) Error(format string, a ...any) (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) FindObject added in v0.14.6

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

func (*Template) FindObjects added in v0.14.6

func (tpl *Template) FindObjects(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) GrafanaCopyDashboard added in v0.14.5

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

func (*Template) GrafanaCreateDashboard added in v0.14.5

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

func (*Template) HttpGet added in v0.10.4

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

func (*Template) HttpGetHeader added in v0.15.11

func (tpl *Template) HttpGetHeader(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) IsNotEmpty added in v0.13.8

func (tpl *Template) IsNotEmpty(v interface{}) (bool, error)

func (*Template) JiraAddComment added in v0.14.4

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

func (*Template) JiraCreateAsset added in v0.13.7

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

func (*Template) JiraCreateIssue added in v0.13.1

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

func (*Template) JiraGetIssueTransition added in v0.14.15

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

func (*Template) JiraIssueTransition added in v0.14.15

func (tpl *Template) JiraIssueTransition(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) JiraSearchIssue added in v0.15.14

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

func (*Template) JiraUpdateIssue added in v0.14.4

func (tpl *Template) JiraUpdateIssue(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) ListFilesWithModTime added in v0.15.11

func (tpl *Template) ListFilesWithModTime(rootDir string) (map[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) NowFmt added in v0.15.9

func (tpl *Template) NowFmt(f string) string

func (*Template) PagerDutyCreateIncident added in v0.12.1

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

func (*Template) PagerDutySendNoteToIncident added in v0.14.4

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

func (*Template) ParserLine added in v0.14.13

func (tpl *Template) ParserLine() (int, error)

func (*Template) PrometheusGet added in v0.14.8

func (tpl *Template) PrometheusGet(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) SSHRun added in v0.15.5

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

func (*Template) Sleep added in v0.13.2

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

func (*Template) SortOccurrences added in v0.15.10

func (tpl *Template) SortOccurrences(occurrences map[string]int, sep string, count int) []string

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) TemplateRender added in v0.14.2

func (tpl *Template) TemplateRender(name string, obj interface{}) (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)

func (*Template) VMRestart added in v0.15.6

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

func (*Template) VMStart added in v0.15.6

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

func (*Template) VMStatus added in v0.15.6

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

func (*Template) VMStop added in v0.15.6

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