template

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingKey = errors.New("missing entry for a key")

ErrMissingKey occurs when storage is missing key

Functions

This section is empty.

Types

type TemplateEngine

type TemplateEngine interface {
	//Replace replaces template values on that provided in storage
	Replace(templateValue string, storage map[string]interface{}) (string, error)
}

TemplateEngine is entity that has ability to work with templated values

type TemplateManager

type TemplateManager struct{}

TemplateManager is entity that has ability to manage templates

func New

func New() TemplateManager

func (TemplateManager) Replace

func (tm TemplateManager) Replace(templateValue string, storage map[string]interface{}) (string, error)

Replace replaces template values in string on that ones provided in storage template values should exist between two brackets {{ }} preceded with dot, for example: "my name is: {{.NAME}}"

Jump to

Keyboard shortcuts

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