engine

package
v0.0.98 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package engine provides a simple templating engine for scaffolding projects.

Index

Constants

This section is empty.

Variables

View Source
var ErrTemplateIsEmpty = fmt.Errorf("template is empty")

ErrTemplateIsEmpty is returned when a provided reader is empty.

Functions

func IsValidIdentifier

func IsValidIdentifier(s string) bool

Types

type Engine

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

func New

func New() *Engine

func (*Engine) Factory

func (e *Engine) Factory(reader io.Reader) (*template.Template, error)

Factory returns a new template from the provided reader. if the reader is empty, an ErrTemplateIsEmpty is returned.

func (*Engine) Render

func (e *Engine) Render(w io.Writer, tmpl *template.Template, vars any) error

func (*Engine) TmplString

func (e *Engine) TmplString(str string, vars any) (string, error)

type Vars

type Vars map[string]any

Jump to

Keyboard shortcuts

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