trace

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, n ast.Node, op string, meta map[string]any) (context.Context, *Node, DoneFn)

Helper to create a node with meta.

Types

type DoneFn

type DoneFn func()

type Node

type Node struct {
	// Kind is a high-level category: "literal", "identifier", "unary", "infix",
	// "block", "field", "index", "call", "import", "ternary", "quantifier",
	// "reduce", "transform", "rule", "policy"
	Kind string `json:"kind"`

	// Op is the operator or sub-kind (e.g., "not", "+", "any", "collect", "filter"),
	// or rule/policy name for those node kinds.
	Op string `json:"op,omitempty"`

	// Duration is the time taken to evaluate the node.
	Duration time.Duration `json:"duration,omitempty"`

	// Node is the AST node that this node is associated with.
	Node ast.Node `json:"-"`

	// Meta holds node-specific metadata (e.g., field name, callee alias, etc.).
	Meta map[string]any `json:"meta,omitempty"`

	// Children are the nested steps under this node.
	Children []*Node `json:"children,omitempty"`

	// Result is the boxed value resulting from this node's evaluation.
	Result box.Value `json:"result,omitempty"`

	// Err (if set) is the error message produced during evaluation of this node.
	Err string `json:"err,omitempty"`
}

Node captures a single evaluation step in the decision tree.

func IgnoredStmt

func IgnoredStmt(n ast.Node) *Node

func UnsupportedExpression

func UnsupportedExpression(n ast.Node) *Node

func (*Node) Attach

func (n *Node) Attach(children ...*Node) *Node

Attach adds children and returns self for chaining.

func (*Node) SetErr

func (n *Node) SetErr(err error) *Node

SetErr annotates the node with an error string.

func (*Node) SetResult

func (n *Node) SetResult(v box.Value) *Node

SetResult sets the node's result and returns self.

Jump to

Keyboard shortcuts

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