value

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package value boxes decoded-JSON data behind a typed accessor API. It is the single place dynamic typing (any) lives in the runner; every other package is statically typed and reaches runtime data only through a value.Value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map map[string]Value

Map is a node's named outputs.

func (Map) Value

func (m Map) Value() Value

Value boxes the map as a single Value so a collection of named outputs can be asserted or extracted over by path — e.g. a child flow's outputs accessed as "{childNode}.{key}".

type Value

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

Value boxes one decoded-JSON value. The zero Value is absent (see IsZero).

func JSON

func JSON(b []byte) Value

JSON parses raw JSON bytes into a Value. Empty or invalid input yields None.

func Of

func Of(v any) Value

Of boxes an arbitrary Go value.

func (Value) Bool

func (v Value) Bool() (bool, bool)

Bool returns the value as a bool when it is one.

func (Value) Get

func (v Value) Get(path string) (Value, bool)

Get resolves an RFC-9535 JSONPath into the value, reporting whether it matched. A bare dotted path ("body.id", "headers.content-type", a hyphenated node id like "create-user.id") resolves member-by-member — every member name is addressable; a path already starting with "$" is used verbatim so full JSONPath ("$.items[*].id", "$.data[?@.active]") works. A single match returns that value; multiple matches return a list.

func (Value) Int

func (v Value) Int() (int64, bool)

Int returns the value as an int64 when it is numeric.

func (Value) IsZero

func (v Value) IsZero() bool

IsZero reports whether the value is absent.

func (Value) List

func (v Value) List() ([]Value, bool)

List returns the value as a slice of Values when it is a JSON array.

func (Value) MarshalJSON

func (v Value) MarshalJSON() ([]byte, error)

MarshalJSON renders the boxed value back to JSON (for results crossing the wire).

func (Value) Raw

func (v Value) Raw() any

Raw returns the underlying value — the explicit escape hatch.

func (Value) Str

func (v Value) Str() (string, bool)

Str returns the value as a string when it is one.

func (Value) String

func (v Value) String() string

String renders the value for comparison and interpolation.

func (*Value) UnmarshalJSON

func (v *Value) UnmarshalJSON(b []byte) error

UnmarshalJSON boxes decoded JSON directly — the one pointer-receiver method (json must write through). It lets a node config declare value.Value / value.Map fields that decode in a single pass, instead of holding json.RawMessage and re-parsing it on every evaluation.

Jump to

Keyboard shortcuts

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