tpl

package
v0.44.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package tpl provides a way to parse a template string and inject secret values into it.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound  = errTemplate.Code("key_not_found").ErrorPref("no value supplied for key %s")
	ErrTagNotClosed = errTemplate.Code("tag_not_closed").ErrorPref("missing closing delimiter '%s'")
)

Errors

Functions

This section is empty.

Types

type Parser added in v0.24.0

type Parser interface {
	Parse(raw string) (Template, error)
}

Parser parses a raw string into a template.

func NewParser added in v0.24.0

func NewParser(startDelim, endDelim string) Parser

NewParser creates a new template parser.

type Template

type Template interface {
	Inject(replacements map[string]string) (string, error)
	Keys() []string
}

Template helps with injecting values into strings that contain the template syntax.

Jump to

Keyboard shortcuts

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