statemachine

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StateDiagram

type StateDiagram struct {
	ID           string       // derived from filename (e.g. "course")
	InitialState string       // state after [*] -->
	States       []string     // all unique state names
	Transitions  []Transition // all state transitions
}

StateDiagram represents a parsed Mermaid stateDiagram.

func Parse

func Parse(id, content string) (*StateDiagram, error)

Parse parses Mermaid stateDiagram content with a given ID.

func ParseDir

func ParseDir(dir string) ([]*StateDiagram, error)

ParseDir parses all *.md files in the given directory.

func ParseFile

func ParseFile(path string) (*StateDiagram, error)

ParseFile parses a single Mermaid stateDiagram markdown file. The diagram ID is derived from the filename (without extension).

func (*StateDiagram) Events

func (d *StateDiagram) Events() []string

Events returns all unique event names in this diagram.

func (*StateDiagram) ValidFromStates

func (d *StateDiagram) ValidFromStates(event string) []string

ValidFromStates returns all states from which the given event is valid.

type Transition

type Transition struct {
	From  string // source state
	To    string // target state
	Event string // operationId / SSaC function name
}

Transition represents a single state transition.

Jump to

Keyboard shortcuts

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