match

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ID = "match"

Variables

This section is empty.

Functions

func Bundle

func Bundle(_ map[string]string) core.Bundle

func CompileCondition added in v0.16.0

func CompileCondition(source string) (*vm.Program, error)

CompileCondition compiles an expression using Flow's input-dot syntax.

func EvaluateProgram added in v0.16.0

func EvaluateProgram(program *vm.Program, env map[string]any) (any, error)

EvaluateProgram runs a compiled condition or subject expression.

func FirstMatchingCase added in v0.16.0

func FirstMatchingCase(cases []ConditionCase, env map[string]any) int

FirstMatchingCase returns the first condition that evaluates to true, or the first default case reached in order. Evaluation failures are skipped, matching the existing match and @on_error behavior.

func KindEnvironment added in v0.16.0

func KindEnvironment() map[string]any

KindEnvironment returns fresh bindings for symbolic Kernel kinds.

func KindEnvironmentFor added in v0.16.0

func KindEnvironmentFor(kindValue any) map[string]any

KindEnvironmentFor returns symbolic bindings with the same runtime representation as kindValue. Legacy @on_error exposes error.kind as a string; expression guards expose it as xerr.Kind.

func KindSymbol added in v0.16.0

func KindSymbol(kind xerr.Kind) string

KindSymbol returns the source spelling of a built-in Kernel kind.

func ResolveKindSymbol added in v0.16.0

func ResolveKindSymbol(symbol string) (xerr.Kind, bool)

ResolveKindSymbol maps a symbolic Flow name to one of the built-in Kernel kinds. It intentionally does not treat xerr.Kind as a closed runtime set: custom values remain possible and are handled by explicit else cases.

func WithKindEnvironment added in v0.16.0

func WithKindEnvironment(env map[string]any) map[string]any

WithKindEnvironment returns a fresh expression environment with built-in Kernel kind symbols added under xerr. The caller's map is never mutated.

Types

type Case

type Case struct {
	Condition string
	IsDefault bool
	Body      core.Expr
}

type ConditionCase added in v0.16.0

type ConditionCase struct {
	Program   *vm.Program
	IsDefault bool
}

ConditionCase is one ordered expression condition, or a default branch. A nil Program is skipped unless IsDefault is true.

type Expr

type Expr struct {
	Subject string
	Cases   []Case
}

func (*Expr) Analyze

func (m *Expr) Analyze(resolver core.CapabilityResolver) error

func (*Expr) Build

func (m *Expr) Build(ctx context.Context, bCtx *core.BuildContext) (action.AnyAction, error)

func (*Expr) Children

func (m *Expr) Children() []core.Expr

func (*Expr) Node

func (*Expr) Node()

Jump to

Keyboard shortcuts

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