entity

package
v0.0.0-...-394db76 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AstTransformer

type AstTransformer struct {
	// Holds name and source of template definitions not found during the first
	// AST transformation pass.
	TransformNotFound map[string]*valueobject.State
}

type Context

type Context struct {
	TemplateNotFound map[string]bool
	// contains filtered or unexported fields
}

func ApplyTemplateTransformers

func ApplyTemplateTransformers(t *valueobject.State, lookupFn func(name string) *valueobject.State) (*Context, error)

type Executor

type Executor struct {
	texttemplate.Executor
}

func (*Executor) ExecuteWithContext

func (t *Executor) ExecuteWithContext(ctx context.Context, templ template.Preparer, wr io.Writer, data any) error

type GoTemplateCallback

type GoTemplateCallback struct {
	Funcs map[string]reflect.Value
}

func (*GoTemplateCallback) BeforeExec

func (t *GoTemplateCallback) BeforeExec(ctx context.Context, tmpl texttemplate.Preparer)

func (*GoTemplateCallback) GetFunc

func (t *GoTemplateCallback) GetFunc(ctx context.Context, tmpl texttemplate.Preparer, name string) (fn reflect.Value, firstArg reflect.Value, found bool)

func (*GoTemplateCallback) GetMapValue

func (t *GoTemplateCallback) GetMapValue(ctx context.Context, tmpl texttemplate.Preparer, receiver, key reflect.Value) (reflect.Value, bool)

func (*GoTemplateCallback) GetMethod

func (t *GoTemplateCallback) GetMethod(ctx context.Context, tmpl texttemplate.Preparer, receiver reflect.Value, name string) (method reflect.Value, firstArg reflect.Value)

func (*GoTemplateCallback) OnCalled

func (t *GoTemplateCallback) OnCalled(ctx context.Context, tmpl texttemplate.Preparer, name string, args []reflect.Value, result reflect.Value)

type Lookup

type Lookup struct {
	BaseOf *valueobject.BaseOf
	Funcsv map[string]reflect.Value
}

func (*Lookup) GetFunc

func (t *Lookup) GetFunc(name string) (reflect.Value, bool)

type Namespace

type Namespace struct {
	*valueobject.StateMap
}

func (*Namespace) Lookup

func (t *Namespace) Lookup(name string) (template.Preparer, bool)

type Parser

type Parser struct {
	PrototypeText *texttemplate.Template
	PrototypeHTML *htmltemplate.Template

	Ast *AstTransformer
	// contains filtered or unexported fields
}

func (*Parser) MarkReady

func (t *Parser) MarkReady() error

func (*Parser) Parse

func (*Parser) ParseOverlap

func (t *Parser) ParseOverlap(overlay, base valueobject.TemplateInfo) (*valueobject.State, bool, error)

func (*Parser) Transform

func (t *Parser) Transform(ns *Namespace, ts *valueobject.State) error

type Template

type Template struct {
	*Executor
	*Lookup

	Parser *Parser

	Main *Namespace
	Fs   template.Fs
}

func (*Template) Execute

func (t *Template) Execute(ctx context.Context, name string, data any) (tmpl string, res string, err error)

func (*Template) LoadTemplates

func (t *Template) LoadTemplates() error

func (*Template) LookupLayout

func (t *Template) LookupLayout(d template.LayoutDescriptor) (template.Preparer, bool, error)

func (*Template) PostTransform

func (t *Template) PostTransform() error

Jump to

Keyboard shortcuts

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