functions

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Definitions map[string]Definition
}

func (Builder) Build

func (b Builder) Build(fns template.FuncMap) (template.FuncMap, error)

Build returns a FuncMap (map[string]interface{}) that can be used in Go Template API, with all functions.

type Definition

type Definition struct {
	Params []ParamDefinition
	Body   string
}

func (Definition) AsCall

func (d Definition) AsCall(name string, args ...interface{}) string

AsCall returns a call instruction of the function with the given param values.

func (Definition) AsScript

func (d Definition) AsScript(name string) string

AsScript returns the function as a compilable script.

type Environment

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

func NewEnvironment

func NewEnvironment() Environment

func (Environment) Compile

func (e Environment) Compile(script string) error

Compile the script and returns the environment needed to run it.

func (Environment) Execute

func (e Environment) Execute(script string) (interface{}, error)

Execute parses script and executes in the specified environment.

type ParamDefinition

type ParamDefinition struct {
	Name string
}

Jump to

Keyboard shortcuts

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