template

package
v0.0.0-...-04b9d05 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const EXT_CFG = ".cfg"

Variables

View Source
var TemplateFunctions map[string]interface{}

Functions

func CleanupOfTemplate

func CleanupOfTemplate(content string) string

func HowDeep

func HowDeep(data interface{}, element interface{}) int

func HowDeepIsIt

func HowDeepIsIt(data interface{}, element interface{}, deep int) int

func IsArray

func IsArray(data interface{}) bool

func IsKind

func IsKind(data interface{}, t string) bool

func IsMap

func IsMap(data interface{}) bool

func IsMapFirst

func IsMapFirst(data interface{}, element interface{}) bool

func IsMapLast

func IsMapLast(data interface{}, element interface{}) bool

func IsNil

func IsNil(data interface{}) bool

func IsString

func IsString(data interface{}) bool

func IsType

func IsType(data interface{}, t string) bool

func UnmarshalJsonArray

func UnmarshalJsonArray(data string) ([]interface{}, error)

func UnmarshalJsonObject

func UnmarshalJsonObject(data string) (map[string]interface{}, error)

Types

type Cell

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

func NewCell

func NewCell(v ...interface{}) (*Cell, error)

func (*Cell) Get

func (c *Cell) Get() interface{}

func (*Cell) Set

func (c *Cell) Set(v interface{}) *Cell

type TemplateDir

type TemplateDir struct {
	Partials *txttmpl.Template
	// contains filtered or unexported fields
}

func NewTemplateDir

func NewTemplateDir(path string, targetRoot string, continueOnError bool) (*TemplateDir, error)

func (*TemplateDir) LoadPartial

func (t *TemplateDir) LoadPartial() error

func (*TemplateDir) Process

func (t *TemplateDir) Process(attributes map[string]interface{}) error

type TemplateFile

type TemplateFile struct {
	Uid      int    `yaml:"uid"`
	Gid      int    `yaml:"gid"`
	CheckCmd string `yaml:"checkCmd"`

	Mode os.FileMode
	// contains filtered or unexported fields
}

func NewTemplateFile

func NewTemplateFile(partials *txttmpl.Template, src string, mode os.FileMode) (*TemplateFile, error)

func (*TemplateFile) RunTemplate

func (f *TemplateFile) RunTemplate(dst string, attributes map[string]interface{}, failOnNoValue bool) error

type Templating

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

func NewTemplating

func NewTemplating(partials *txttmpl.Template, filePath, content string) (*Templating, error)

func (*Templating) AddFunction

func (t *Templating) AddFunction(name string, fn interface{})

func (*Templating) AddFunctions

func (t *Templating) AddFunctions(fs map[string]interface{})

func (*Templating) Execute

func (t *Templating) Execute(wr io.Writer, data interface{}) error

Jump to

Keyboard shortcuts

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