expr

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Evaluate

func Evaluate(ex string, env any) (interface{}, error)

func EvaluateString

func EvaluateString(ex string, env any) (string, error)

func IsTruthy

func IsTruthy(ex string, env any) (bool, error)

Types

type CtxData

type CtxData struct {
	Workspace     string `expr:"workspace"`
	Namespace     string `expr:"namespace"`
	WorkspacePath string `expr:"workspacePath"`
	FlowFileName  string `expr:"flowFileName"`
	FlowFilePath  string `expr:"flowFilePath"`
	FlowFileDir   string `expr:"flowFileDir"`
}

type ExpressionData

type ExpressionData struct {
	OS    string            `expr:"os"`
	Arch  string            `expr:"arch"`
	Ctx   *CtxData          `expr:"ctx"`
	Store map[string]string `expr:"store"`
	Env   map[string]string `expr:"env"`
}

func ExpressionEnv

func ExpressionEnv(
	ctx *context.Context,
	executable *executable.Executable,
	dataMap, envMap map[string]string,
) ExpressionData

type Template

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

Template wraps text/template but evaluates expressions using expr instead

func NewTemplate

func NewTemplate(name string, data any) *Template

func (*Template) Execute

func (t *Template) Execute(wr io.Writer) error

func (*Template) ExecuteToString

func (t *Template) ExecuteToString() (string, error)

func (*Template) Parse

func (t *Template) Parse(text string) error

Jump to

Keyboard shortcuts

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