templates

package
v1.101.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FuncsWithExternalURL

func FuncsWithExternalURL(externalURL *url.URL) textTpl.FuncMap

FuncsWithExternalURL returns a function map that depends on externalURL value

func FuncsWithQuery

func FuncsWithQuery(query QueryFn) textTpl.FuncMap

FuncsWithQuery returns a function map that depends on metric data

func Get

func Get() (*textTpl.Template, error)

Get returns a copy of a template

func GetWithFuncs

func GetWithFuncs(funcs textTpl.FuncMap) (*textTpl.Template, error)

GetWithFuncs returns a copy of current template with additional FuncMap provided with funcs argument

func Load

func Load(pathPatterns []string, overwrite bool) error

Load func loads templates from multiple globs specified in pathPatterns and either sets them directly to current template if it's undefined or with overwrite=true or sets replacement templates and adds templates with new names to a current

func Reload

func Reload()

Reload func replaces current template with a replacement template which was set by Load with override=false

func UpdateWithFuncs

func UpdateWithFuncs(funcs textTpl.FuncMap)

UpdateWithFuncs updates existing or sets a new function map for a template

Types

type QueryFn

type QueryFn func(query string) ([]datasource.Metric, error)

QueryFn is used to wrap a call to datasource into simple-to-use function for templating functions.

type Time

type Time int64

Time is the number of milliseconds since the epoch (1970-01-01 00:00 UTC) excluding leap seconds.

func (Time) Time

func (t Time) Time() time.Time

Time returns the time.Time representation of t.

Jump to

Keyboard shortcuts

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