dsl

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder manages the graph construction.

func New

func New() *Builder

New creates a new graph builder.

func (*Builder) Add

func (b *Builder) Add(id string) *NodeBuilder

Add creates a new node in the graph. If the node already exists, it returns the existing builder.

func (*Builder) Build

func (b *Builder) Build() (*memory.Loader, error)

Build compiles the graph into a MemoryLoader.

type NodeBuilder

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

NodeBuilder provides a fluent API for configuring a node.

func (*NodeBuilder) Branch

func (n *NodeBuilder) Branch(condition string, target string) *NodeBuilder

Branch adds a conditional transition to the target node.

func (*NodeBuilder) Build

func (n *NodeBuilder) Build() domain.Node

Build returns the underlying domain.Node. This is primarily used by the Builder, but exposed for advanced usage.

func (*NodeBuilder) Context

func (n *NodeBuilder) Context(key string, value any) *NodeBuilder

Context adds a default context value to the node.

func (*NodeBuilder) Error

func (n *NodeBuilder) Error(target string) *NodeBuilder

Error sets the target node for error handling.

func (*NodeBuilder) Go

func (n *NodeBuilder) Go(target string) *NodeBuilder

Go adds an unconditional transition to the target node.

func (*NodeBuilder) Input

func (n *NodeBuilder) Input(inputType string, options ...string) *NodeBuilder

Input configures the input type and options for a question node.

func (*NodeBuilder) On

func (n *NodeBuilder) On(signal string, target string) *NodeBuilder

On adds a signal handler to the node.

func (*NodeBuilder) Question

func (n *NodeBuilder) Question(content string) *NodeBuilder

Question sets the content of the node and marks it as a question node (hard step).

func (*NodeBuilder) SaveTo

func (n *NodeBuilder) SaveTo(variable string) *NodeBuilder

SaveTo specifies the context variable to save the input to.

func (*NodeBuilder) Text

func (n *NodeBuilder) Text(content string) *NodeBuilder

Text sets the content of the node and marks it as a text node (soft step).

Jump to

Keyboard shortcuts

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