sdtemplate

package
v0.0.0-...-8c1e015 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TemplateFuncMap = template.FuncMap{
	"escape_tag_key":   EscapeTagKey,
	"format_indent":    FormatIndent,
	"as_key_value_map": AsKeyValueMap,
	"to_toml_array":    ToTomlArray,
}

Functions

func AsKeyValueMap

func AsKeyValueMap(m map[string]string, indent int) string

func EscapeTagKey

func EscapeTagKey(key string) string

escape a tag key for influxdb

func FormatIndent

func FormatIndent(value string, spaces string) string

indent a group of values by a given amount of spaces

func ToTomlArray

func ToTomlArray(values []string) string

Types

type MatcherSpec

type MatcherSpec struct {
}

type Template

type Template struct {
	Spec     *TemplateSpec
	FileName string
	// contains filtered or unexported fields
}

func NewTemplate

func NewTemplate(filePath string) (*Template, error)

Create new config and populate it from environment

func (*Template) Execute

func (tpl *Template) Execute(wr io.Writer, data interface{}) error

type TemplateSpec

type TemplateSpec struct {
	Name         string        `yaml:"name"`
	Backend      string        `yaml:"backend"`
	Template     string        `yaml:"template"`
	TemplateType string        `yaml:"templateType"`
	Labels       []string      `yaml:"labels"`
	Matchers     []MatcherSpec `yaml:"matchers"`
}

func ParseSpec

func ParseSpec(raw []byte) (*TemplateSpec, error)

func ParseSpecFile

func ParseSpecFile(file string) (*TemplateSpec, error)

Jump to

Keyboard shortcuts

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