expression

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DigObject

func DigObject(object any, key string) (any, error)

func Evaluate

func Evaluate(obj any, s string) (*structpb.Value, error)

func Expand

func Expand(obj *InterpolationContext, value *structpb.Value) (*structpb.Value, error)

func ExpandString

func ExpandString(obj *InterpolationContext, value string) (string, error)

The ExpandString rewrites string and returns string

func FormatEvalErr added in v0.22.0

func FormatEvalErr(err error, value string) error

func FormatParseErr added in v0.22.0

func FormatParseErr(err error, value string) error

func MoaValueToStructPbValue added in v0.18.0

func MoaValueToStructPbValue(val value.Value) (*structpb.Value, error)

func NewEnv added in v0.20.0

func NewEnv() *stdlib.Env

NewEnv creates a new moa environment.

The environment contains the standard library function with an empty context. Use AddContext to add values to the context. This environment is shared between the step-runner and the runner (for job inputs interpolation).

func ObjectToProtoValue

func ObjectToProtoValue(object any) (*structpb.Value, error)

func StructPbValueToMoaValue added in v0.18.0

func StructPbValueToMoaValue(val *structpb.Value) value.Value

func ValueToString

func ValueToString(v *structpb.Value) (string, error)

Types

type EvalError added in v0.22.0

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

func (*EvalError) Error added in v0.22.0

func (e *EvalError) Error() string

func (*EvalError) Unwrap added in v0.22.0

func (e *EvalError) Unwrap() error

type InterpolationContext

type InterpolationContext struct {
	Env         map[string]string          `json:"env"`
	ExportFile  string                     `json:"export_file"`
	Inputs      map[string]*structpb.Value `json:"inputs"`
	Job         map[string]*structpb.Value `json:"job"`
	OutputFile  string                     `json:"output_file"`
	StepDir     string                     `json:"step_dir"`
	StepResults map[string]*StepResultView `json:"steps"`
	WorkDir     string                     `json:"work_dir"`
}

InterpolationContext contains fields that can be accessed by expressions.

func (*InterpolationContext) ToStructPbValue added in v0.18.0

func (ic *InterpolationContext) ToStructPbValue() *structpb.Value

type ParseError added in v0.22.0

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

func (*ParseError) Error added in v0.22.0

func (e *ParseError) Error() string

func (*ParseError) Unwrap added in v0.22.0

func (e *ParseError) Unwrap() error

type StepResultView

type StepResultView struct {
	Outputs map[string]*structpb.Value `json:"outputs"`
}

Jump to

Keyboard shortcuts

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