statictemplate

package
Version: v0.0.0-...-510411a Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package statictemplate implements a code generator for converting text or html/template to Go code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Translate

func Translate(template interface{}, pkg string, instructions []TranslateInstruction) ([]byte, error)

Translate is a convenience method for New(template).Translate(pkg, instructions)

Types

type TranslateInstruction

type TranslateInstruction struct {
	FunctionName string
	TemplateName string
	Dot          types.Type
}

TranslateInstruction specifies a single function to be generated from a template

type Translator

type Translator struct {
	Funcs map[string]*types.Func
	// contains filtered or unexported fields
}

Translator converts a template with a set of instructions to Go code

func New

func New(template interface{}) *Translator

New creates a new instance of Translator

func (*Translator) Translate

func (t *Translator) Translate(pkg string, instructions []TranslateInstruction) ([]byte, error)

Translate converts a template with a set of instructions to Go code

Jump to

Keyboard shortcuts

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