template

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package template provides tools to render template strings and template files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(templateText string, data interface{}) (string, error)

Render renders template text with data.

func RenderReader

func RenderReader(r io.Reader, data interface{}) (string, error)

RenderReader renders a template obtained from a reader with data.

Types

type Values

type Values map[string]interface{}

Values are passed to templates while rendering.

func LoadValues

func LoadValues(path string) (Values, error)

LoadValues loads values from a file.

func MergeValues

func MergeValues(values ...Values) (Values, error)

MergeValues merges values on top of each other from left to right. Returns a new Values map.

func (Values) Merge

func (v Values) Merge(other Values) error

Merge merges other on top of v. Non-zero fields in other will override the same fields in v.

Jump to

Keyboard shortcuts

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