eval

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package eval provides commands for evaluating and validating CEL expressions and Go templates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandCEL

func CommandCEL(cliParams *settings.Run, ioStreams *terminal.IOStreams, path string) *cobra.Command

CommandCEL creates the 'eval cel' command.

func CommandEval

func CommandEval(cliParams *settings.Run, ioStreams *terminal.IOStreams, path string) *cobra.Command

CommandEval creates the 'eval' command group.

func CommandTemplate

func CommandTemplate(cliParams *settings.Run, ioStreams *terminal.IOStreams, path string) *cobra.Command

CommandTemplate creates the 'eval template' command.

func CommandValidate

func CommandValidate(cliParams *settings.Run, ioStreams *terminal.IOStreams, path string) *cobra.Command

CommandValidate creates the 'eval validate' command.

Types

type CELOptions

type CELOptions struct {
	IOStreams  *terminal.IOStreams
	CliParams  *settings.Run
	Output     string
	Expression string
	Vars       []string
	Data       string
	File       string
}

CELOptions holds options for the eval cel command.

func (*CELOptions) Run

func (o *CELOptions) Run(ctx context.Context) error

Run executes the eval cel command.

type CELResult

type CELResult struct {
	Expression string `json:"expression" yaml:"expression" doc:"The CEL expression that was evaluated"`
	Result     any    `json:"result" yaml:"result" doc:"The evaluation result"`
	Type       string `json:"type" yaml:"type" doc:"The Go type of the result"`
}

CELResult holds the result of evaluating a CEL expression.

type TemplateOptions

type TemplateOptions struct {
	IOStreams    *terminal.IOStreams
	CliParams    *settings.Run
	Output       string
	Template     string
	TemplateFile string
	Vars         []string
	Data         string
	File         string
	ShowRefs     bool
}

TemplateOptions holds options for the eval template command.

func (*TemplateOptions) Run

func (o *TemplateOptions) Run(ctx context.Context) error

Run executes the eval template command.

type TemplateResult

type TemplateResult struct {
	Output     string                     `json:"output" yaml:"output" doc:"The rendered template output"`
	Template   string                     `json:"template" yaml:"template" doc:"The template that was evaluated"`
	References []gotmpl.TemplateReference `json:"references,omitempty" yaml:"references,omitempty" doc:"Referenced template variables"`
}

TemplateResult holds the result of evaluating a Go template.

type ValidateOptions

type ValidateOptions struct {
	IOStreams  *terminal.IOStreams
	CliParams  *settings.Run
	Output     string
	Expression string
	Type       string
}

ValidateOptions holds options for the eval validate command.

func (*ValidateOptions) Run

func (o *ValidateOptions) Run(ctx context.Context) error

Run executes the eval validate command.

type ValidateResult

type ValidateResult struct {
	Expression string   `json:"expression" yaml:"expression" doc:"The expression that was validated" maxLength:"4096"`
	Type       string   `json:"type" yaml:"type" doc:"The expression type (cel or go-template)" maxLength:"20"`
	Valid      bool     `json:"valid" yaml:"valid" doc:"Whether the expression is syntactically valid"`
	Error      string   `json:"error,omitempty" yaml:"error,omitempty" doc:"Error message if invalid" maxLength:"4096"`
	References []string `json:"references,omitempty" yaml:"references,omitempty" doc:"Referenced variables found in the expression" maxItems:"100"`
}

ValidateResult holds the result of validating an expression.

Jump to

Keyboard shortcuts

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