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