templater

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompleteFuncMap

func CompleteFuncMap(names []string, a []any) map[string]any

func CopyTemplatesToTemp added in v0.0.5

func CopyTemplatesToTemp(s string) error

func ExecHeaderTemplate added in v0.0.5

func ExecHeaderTemplate(output io.Writer) error

func GetTemplateInterfaces

func GetTemplateInterfaces(iface ...any) (ifaces []any)

func GoFmt

func GoFmt(path string) error

GoFmt execute go fmt for specific .go file from the code

func TempDir added in v0.0.5

func TempDir() error

Types

type ITemplate

type ITemplate interface {
	Generate() error
	Excluded() bool
	GenerateNonGo() error
}

func NewTemplate

func NewTemplate(path, output string, ifaces []any, funcMap template.FuncMap, elems ...string) ITemplate

NewTemplate is

type Template

type Template struct {
	Elems                              []string
	Ifaces                             []interface{}
	ConfigTemplatePath, OutPutFilePath string
	FuncMap                            template.FuncMap
	IsExcluded                         bool
}

func (*Template) Excluded

func (t *Template) Excluded() bool

func (*Template) Generate

func (t *Template) Generate() error

Generate is main generation function

func (*Template) GenerateFile

func (t *Template) GenerateFile() error

func (*Template) GenerateNonGo

func (t *Template) GenerateNonGo() error

GenerateNonGo is main generation function for non .go files

type Templates

type Templates []ITemplate

func GetAll

func GetAll(templates ...ITemplate) Templates

Jump to

Keyboard shortcuts

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