template

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultFuncs

func GetDefaultFuncs() template.FuncMap

GetDefaultFuncs returns default template functions

Types

type Manager

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

Manager manages code generation templates

func NewManager

func NewManager(log logger.Logger) *Manager

NewManager creates a new template manager

func (*Manager) Get

func (m *Manager) Get(name string) (*Template, error)

Get retrieves a template by name

func (*Manager) List

func (m *Manager) List() []*Template

List returns all registered templates

func (*Manager) ListByLanguage

func (m *Manager) ListByLanguage(lang string) []*Template

ListByLanguage returns templates for a specific language

func (*Manager) Register

func (m *Manager) Register(tmpl *Template) error

Register registers a new template

func (*Manager) Render

func (m *Manager) Render(ctx context.Context, templateName string, data interface{}, outputPath string) error

Render renders a template with given data

type Template

type Template struct {
	Name     string            // Template name
	Language string            // Target language
	Path     string            // Template files path
	Patterns []string          // File patterns to match (*.tmpl)
	Vars     map[string]string // Template variables
	Funcs    template.FuncMap  // Custom template functions
}

Template represents a code generation template

type TemplateConfig

type TemplateConfig struct {
	Templates []Template `yaml:"templates" mapstructure:"templates"`
}

TemplateConfig holds template configuration

Jump to

Keyboard shortcuts

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