tmpl

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package tmpl resolves {{ref}} / {{{ref}}} template tokens in a raw node definition against the node's input view (flow inputs + upstream outputs) and optional dynamic-variable generators, before the node is decoded. Refs use the same path addressing as assertions (value.Value.Get), so templates and assertions are symmetric. Nodes never see templates — they receive fully resolved, typed config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resolve

func Resolve(raw json.RawMessage, view value.Value, dyn DynFunc) (json.RawMessage, error)

Resolve substitutes template tokens in raw using the input view and dynamic-var resolver, returning resolved JSON. Unresolved refs are left verbatim so a typo is visible rather than silently empty.

It rewrites the raw bytes directly: templates can only occur inside JSON string values, so everything outside string literals (and every string with no token) is copied verbatim, skipping the unmarshal-to-any/walk/remarshal round trip that dominated templated-node cost. Object keys are never templated (matching the previous walk, which only visited values).

Types

type DynFunc

type DynFunc func(name string, args []string) (string, error)

DynFunc resolves a {{$name:arg:arg}} dynamic variable to a string. Nil disables dynamic variables (unresolved tokens are left verbatim).

Jump to

Keyboard shortcuts

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