template

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(tpl *Template, env *Env) (*Template, *Env, error)

func IsRevertible

func IsRevertible(t *Template) bool

func NewDefaultPrinter added in v0.0.20

func NewDefaultPrinter(w io.Writer) *defaultPrinter

func NewLogPrinter added in v0.0.20

func NewLogPrinter(w io.Writer) *logPrinter

func ParseParams

func ParseParams(text string) (map[string]interface{}, error)

Types

type CollectDefinitions

type CollectDefinitions struct {
	C []TemplateDefinition
	L LookupTemplateDefFunc
}

func (*CollectDefinitions) Visit

func (t *CollectDefinitions) Visit(cmds []*ast.CommandNode) error

type Env

type Env struct {
	Fillers map[string]interface{}

	Resolved         map[string]interface{}
	DefLookupFunc    LookupTemplateDefFunc
	AliasFunc        func(entity, key, alias string) string
	MissingHolesFunc func(string) interface{}

	Log *logger.Logger
}

func NewEnv

func NewEnv() *Env

func (*Env) AddFillers

func (e *Env) AddFillers(fills ...map[string]interface{})

type LookupGraphFunc

type LookupGraphFunc func(key string) (*graph.Graph, bool)

type LookupTemplateDefFunc

type LookupTemplateDefFunc func(key string) (TemplateDefinition, bool)

type Printer

type Printer interface {
	Print(*Template)
}

type Template

type Template struct {
	ID string
	*ast.AST
}

func MustParse

func MustParse(text string) *Template

func Parse

func Parse(text string) (*Template, error)

func (*Template) CmdNodesReverseIterator

func (s *Template) CmdNodesReverseIterator() (nodes []*ast.CommandNode)

func (*Template) CommandNodesIterator

func (s *Template) CommandNodesIterator() (nodes []*ast.CommandNode)

func (*Template) Compile

func (s *Template) Compile(d driver.Driver) (*Template, error)

func (*Template) HasErrors

func (t *Template) HasErrors() bool

func (*Template) IsSameAs

func (s *Template) IsSameAs(t2 *Template) bool

func (*Template) MarshalJSON

func (t *Template) MarshalJSON() ([]byte, error)

func (*Template) Revert

func (te *Template) Revert() (*Template, error)

func (*Template) Run

func (s *Template) Run(d driver.Driver) (*Template, error)

func (*Template) UnmarshalJSON

func (t *Template) UnmarshalJSON(b []byte) error

func (*Template) Validate

func (s *Template) Validate(rules ...Validator) (all []error)

func (*Template) Visit

func (s *Template) Visit(v Visitor) error

type TemplateDefinition

type TemplateDefinition struct {
	Action, Entity, Api         string
	RequiredParams, ExtraParams []string
}

func (TemplateDefinition) Extra

func (def TemplateDefinition) Extra() []string

func (TemplateDefinition) GetTemplate

func (def TemplateDefinition) GetTemplate() (*Template, error)

func (TemplateDefinition) Name

func (def TemplateDefinition) Name() string

func (TemplateDefinition) Required

func (def TemplateDefinition) Required() []string

func (TemplateDefinition) String

func (def TemplateDefinition) String() string

type UniqueNameValidator

type UniqueNameValidator struct {
	LookupGraph LookupGraphFunc
}

func (*UniqueNameValidator) Execute

func (v *UniqueNameValidator) Execute(t *Template) (errs []error)

type Validator

type Validator interface {
	Execute(t *Template) []error
}

type Visitor

type Visitor interface {
	Visit([]*ast.CommandNode) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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