dynamicvars

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package dynamicvars resolves {{$name:args}} template variables to generated fake data. The {{$...}} namespace is owned here; generators are backed by gofakeit for breadth. It satisfies the resolver the engine wires into node.Runtime.Vars (Resolve(name, args) (string, error)).

Determinism: a Context is seeded from the execution id, so a given execution produces a stable stream of values and different executions differ. Draws are mutex-guarded; under concurrent draws the order (and thus exact values) can vary, so values are unique-per-run, not yet identical on replay.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

Context holds the per-execution generator state and satisfies the dynamic resolver the engine expects.

func New

func New(executionID string) *Context

New builds a Context seeded deterministically from the execution id, so the same execution replays the same stream of values.

func NewEphemeral

func NewEphemeral() *Context

NewEphemeral builds a Context seeded from a fresh random source — unique per process, not reproducible. Use it for the default runtime, when no execution id is available; real executions should use New(executionID).

func (*Context) Resolve

func (c *Context) Resolve(name string, args []string) (string, error)

Resolve returns the value for $name with optional colon-separated args.

type Entry

type Entry struct {
	Name     string
	Category string
	Desc     string
	Example  string
	// contains filtered or unexported fields
}

Entry documents one generator. Desc and Example feed discovery (docs, the CLI, and AI agents listing available variables).

func Catalog

func Catalog() []Entry

Catalog returns every generator, sorted by category then name, for documentation and discovery by users and AI agents.

Jump to

Keyboard shortcuts

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