tpl

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TemplateFuncs = template.FuncMap{
		"add":            func(a, b int) int { return a + b },
		"snakecase":      func(s string) string { return utils.SnakeCase(s) },
		"kebabcase":      func(s string) string { return utils.Kebab(s) },
		"camelcase":      func(s string) string { return utils.CamelCase(s) },
		"smallcamelcase": func(s string) string { return utils.SmallCamelCase(s) },
	}

	Template = template.Must(
		template.New("components").
			Funcs(TemplateFuncs).
			ParseFS(Static, "template/layout/*"),
	)

	Model  = Template.Lookup("model.tpl")
	Mapper = Template.Lookup("mapper.tpl")
	SqlDDL = Template.Lookup("sql_ddl.tpl")
)
View Source
var BuiltInModelMapping = map[string]TemplateMapping{
	"__in_go":     {Model, ".go"},
	"__in_mapper": {Mapper, ".proto"},
}
View Source
var Static embed.FS

Functions

func ParseTemplateFromFile added in v0.4.0

func ParseTemplateFromFile(filename string) (*template.Template, error)

Types

type TemplateMapping added in v0.4.0

type TemplateMapping struct {
	Template *template.Template
	Suffix   string
}

Jump to

Keyboard shortcuts

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