flow_engine

package
v1.0.68 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AndExpr

type AndExpr struct {
	Left, Right ConditionExpr
}

func (AndExpr) Evaluate

func (e AndExpr) Evaluate(state map[string]interface{}) (bool, error)

type ComparisonExpr

type ComparisonExpr struct {
	Left, Right string
	Operator    string
}

func (ComparisonExpr) Evaluate

func (e ComparisonExpr) Evaluate(state map[string]interface{}) (bool, error)

type ConditionExpr

type ConditionExpr interface {
	Evaluate(state map[string]interface{}) (bool, error)
}

Condition expression parsing and evaluation

type FlowEngine

type FlowEngine struct {
	State     map[string]any
	Functions map[string]any
	Templates map[string]string
	Steps     []FlowStep
}

1. Definisi struktur Flow Engine

func NewFlowEngine

func NewFlowEngine() *FlowEngine

2. Inisialisasi Flow Engine

func (*FlowEngine) Execute

func (e *FlowEngine) Execute() error

5. Eksekusi Flow

func (*FlowEngine) ExecuteAPICallStep

func (e *FlowEngine) ExecuteAPICallStep(step FlowStep) error

func (*FlowEngine) ExecuteConditionalStep

func (e *FlowEngine) ExecuteConditionalStep(step FlowStep) error

func (*FlowEngine) ExecuteFunctionStep

func (e *FlowEngine) ExecuteFunctionStep(step FlowStep) error

6. Eksekusi Function Step dengan Reflection

func (*FlowEngine) ExecuteSingleStep

func (e *FlowEngine) ExecuteSingleStep(step FlowStep) error

func (*FlowEngine) FindStepByName

func (e *FlowEngine) FindStepByName(name string) *FlowStep

func (*FlowEngine) LoadFlowFromFile

func (e *FlowEngine) LoadFlowFromFile(filename string) error

4. Load Flow dari JSON

func (*FlowEngine) RegisterFunction

func (e *FlowEngine) RegisterFunction(name string, fn any)

3. Registrasi Function

type FlowStep

type FlowStep struct {
	Name          string         `json:"name"`
	Description   string         `json:"description"`
	Type          string         `json:"type"` // "function", "api_call", "conditional"
	Function      string         `json:"function,omitempty"`
	Params        map[string]any `json:"params"`
	NextOnSuccess string         `json:"next_on_success,omitempty"`
	NextOnError   string         `json:"next_on_error,omitempty"`
}

type OrExpr

type OrExpr struct {
	Left, Right ConditionExpr
}

func (OrExpr) Evaluate

func (e OrExpr) Evaluate(state map[string]interface{}) (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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