template

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	Extension() string
	mtemplate.Validator
}

Context is an interface that a template file context, i.e., the object manipulated inside the template file, must implement.

type Generated

type Generated struct {
	Filename     string
	TemplateName string
	Extension    string
	Data         *bytes.Buffer
}

Generated holds the template content already parsed, ready to be saved.

type Info

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

type Options

type Options struct {
	// StrictValidators if enabled forces us to use the validator function
	// for a template only if it is declared. Otherwise, the template will be
	// ignored.
	StrictValidators bool
	Kind             mtemplate.Kind
	Path             string
	FilesPrefix      string `validate:"required"`
	Plugin           *protogen.Plugin
	Files            embed.FS `validate:"required"`
	Context          Context  `validate:"required"`
	HelperFunctions  map[string]interface{}
	Addons           []*addon.Addon
}

type Templates

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

Templates is an object that holds information related to a group of template files, allowing them to be executed later.

func LoadTemplates

func LoadTemplates(options Options) (*Templates, error)

func (*Templates) Execute

func (t *Templates) Execute() ([]*Generated, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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