Documentation
¶
Index ¶
- type Builder
- type NodeBuilder
- func (n *NodeBuilder) Branch(condition string, target string) *NodeBuilder
- func (n *NodeBuilder) Build() domain.Node
- func (n *NodeBuilder) Context(key string, value any) *NodeBuilder
- func (n *NodeBuilder) Error(target string) *NodeBuilder
- func (n *NodeBuilder) Go(target string) *NodeBuilder
- func (n *NodeBuilder) Input(inputType string, options ...string) *NodeBuilder
- func (n *NodeBuilder) On(signal string, target string) *NodeBuilder
- func (n *NodeBuilder) Question(content string) *NodeBuilder
- func (n *NodeBuilder) SaveTo(variable string) *NodeBuilder
- func (n *NodeBuilder) Text(content string) *NodeBuilder
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 (*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.
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).