template

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package template implements data-driven templates for generating a value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(i, data interface{}) (interface{}, error)

Execute executes templates of i with data.

Types

type Func

type Func interface {
	Exec(arg interface{}) (interface{}, error)
	UnmarshalArg(unmarshal func(interface{}) error) (interface{}, error)
}

Func represents a left arrow function.

type Template

type Template struct {
	// contains filtered or unexported fields
}

Template is the representation of a parsed template.

func New

func New(str string) (*Template, error)

New parses text as a template and returns it.

func (*Template) Execute

func (t *Template) Execute(data interface{}) (ret interface{}, retErr error)

Execute applies a parsed template to the specified data.

Directories

Path Synopsis
Package ast declares the types used to represent syntax trees.
Package ast declares the types used to represent syntax trees.
Package parser implements a parser for a template string.
Package parser implements a parser for a template string.
Package token defines constants representing the lexical tokens.
Package token defines constants representing the lexical tokens.

Jump to

Keyboard shortcuts

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