Documentation
¶
Index ¶
- func Example()
- type DotEdgeSpec
- type DotNodeSpec
- type Progress
- type State
- type Step
- type StepDetails
- type Workflow
- func (w *Workflow) AddStep(step *Step) error
- func (w *Workflow) FromString(str string) error
- func (w *Workflow) GetCurrentStep() *Step
- func (w *Workflow) GetProgress() *Progress
- func (w *Workflow) GetState() *WorkflowState
- func (w *Workflow) GetStep(name string) *Step
- func (w *Workflow) GetStepMeta(step any, key string) any
- func (w *Workflow) GetSteps() []*Step
- func (w *Workflow) IsStepComplete(step any) bool
- func (w *Workflow) IsStepCurrent(step any) bool
- func (w *Workflow) MarkStepAsCompleted(step any) bool
- func (w *Workflow) SetCurrentStep(step any) error
- func (w *Workflow) SetStepMeta(step any, key string, value interface{})
- func (w *Workflow) ToString() (string, error)
- func (w *Workflow) Visualize() string
- type WorkflowState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DotEdgeSpec ¶
type DotEdgeSpec struct { FromNodeName string ToNodeName string Tooltip string Style string Color string }
DotEdgeSpec represents an edge in the DOT graph
type DotNodeSpec ¶
type DotNodeSpec struct { Name string DisplayName string Tooltip string Shape string Style string FillColor string }
DotNodeSpec represents a node in the DOT graph
type State ¶
State represents a workflow state
func (*State) GetActionLink ¶
GetActionLink returns the action link for the state
type Step ¶
Step represents a single step in a workflow
func (*Step) GetActionLink ¶
GetActionLink returns the action link for the step Note: This is a placeholder implementation as the PHP version uses a framework-specific function
type StepDetails ¶
StepDetails contains metadata about a step
type Workflow ¶
type Workflow struct {
// contains filtered or unexported fields
}
Workflow represents a workflow
func (*Workflow) AddStep ¶
AddStep adds a step to the workflow
Business logic: 1. Check if step already exists 2. Add step to steps map 3. If first step, set it as current step 4. Add step details to step details map
func (*Workflow) FromString ¶
FromString deserializes the workflow state from a string
func (*Workflow) GetCurrentStep ¶
GetCurrentStep returns the current step
func (*Workflow) GetProgress ¶
GetProgress returns the workflow progress
func (*Workflow) GetState ¶
func (w *Workflow) GetState() *WorkflowState
GetState returns the current workflow state
func (*Workflow) GetStepMeta ¶
GetStepMeta returns step metadata
Business logic: 1. Get step name 2. Get step metadata 3. Return metadata or nil if key not found
func (*Workflow) IsStepComplete ¶
IsStepComplete checks if a step is completed
Business logic: 1. Get step name 2. Get step positions 3. If step is before the current step, it's complete 4. If step is explicitly marked as completed, it's complete
func (*Workflow) IsStepCurrent ¶
IsStepCurrent checks if a step is the current step
func (*Workflow) MarkStepAsCompleted ¶
MarkStepAsCompleted marks a step as completed
Business logic: 1. Get step name 2. Mark step as completed 3. Return true if step was marked as completed
func (*Workflow) SetCurrentStep ¶
SetCurrentStep sets the current step, can be a step name or a step pointer
Business logic: 1. Check if step exists 2. Mark the current step as completed 3. Set the current step to the new step
func (*Workflow) SetStepMeta ¶
SetStepMeta sets step metadata
type WorkflowState ¶
type WorkflowState struct { CurrentStepName string // History is the history of steps that have been completed // and the current step, which has been started History []string StepDetails map[string]*StepDetails }
WorkflowState represents the current state of a workflow