Documentation
¶
Index ¶
Constants ¶
View Source
const ( OperatorEquals = "eq" OperatorNotEquals = "ne" OperatorIn = "in" OperatorNotIn = "nin" OperatorIsNull = "isNull" OperatorIsNotNull = "isNotNull" OperatorGt = "gt" OperatorLt = "lt" OperatorGe = "ge" OperatorLe = "le" )
View Source
const ( Success = "success" Failed = "failed" Skip = "skip" True = "true" False = "false" )
View Source
const (
Js = "Js" // Represents JavaScript scripting language.
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BranchComponent ¶
type BranchComponent struct {
// contains filtered or unexported fields
}
StartComponent 启动组件
func NewBranchComponent ¶
func NewBranchComponent(config json.RawMessage) (*BranchComponent, error)
func (*BranchComponent) AnalyzeInputs ¶
func (c *BranchComponent) AnalyzeInputs(ctx context.Context) (any, error)
func (*BranchComponent) Validate ¶
func (c *BranchComponent) Validate() []core.ValidationError
type BranchConfig ¶
type BranchConfig struct {
Conditions []Condition `json:"conditions"`
}
type CodejsComponent ¶
type CodejsComponent struct {
// contains filtered or unexported fields
}
CodejsComponent 代码执行组件
func NewCodejsComponent ¶
func NewCodejsComponent(config json.RawMessage) (*CodejsComponent, error)
func (*CodejsComponent) AnalyzeInputs ¶
func (c *CodejsComponent) AnalyzeInputs(ctx context.Context) (any, error)
func (*CodejsComponent) Validate ¶
func (c *CodejsComponent) Validate() []core.ValidationError
type CodejsConfig ¶
type CodejsConfig struct {
Code string `json:"code"`
}
type Component ¶
type Component interface {
Validate() []core.ValidationError
AnalyzeInputs(ctx context.Context) (any, error)
Execute(ctx context.Context, input any) (*core.Result, error)
}
Component 定义组件核心接口
func ComponentFactory ¶
func ComponentFactory(nodeType string, nodeConfig *core.NodeDefinition) (Component, error)
ComponentFactory 组件工厂
type EndComponent ¶
type EndComponent struct {
// contains filtered or unexported fields
}
EndComponent 结束组件
func NewEndComponent ¶
func NewEndComponent(config json.RawMessage) (*EndComponent, error)
func (*EndComponent) AnalyzeInputs ¶
func (c *EndComponent) AnalyzeInputs(ctx context.Context) (any, error)
func (*EndComponent) Validate ¶
func (c *EndComponent) Validate() []core.ValidationError
type GojaJsEngine ¶
type GojaJsEngine struct {
// contains filtered or unexported fields
}
GojaJsEngine goja js engine
func NewGojaJsEngine ¶
func NewGojaJsEngine(jsScript string, fromVars map[string]interface{}) (*GojaJsEngine, error)
NewGojaJsEngine Create a new instance of the JavaScript engine
func (*GojaJsEngine) Execute ¶
func (g *GojaJsEngine) Execute(functionName string, argumentList ...interface{}) (out interface{}, err error)
Execute Execute JavaScript script
func (*GojaJsEngine) NewVm ¶
func (g *GojaJsEngine) NewVm(config Config, fromVars map[string]interface{}) *goja.Runtime
NewVm new a js VM
func (*GojaJsEngine) PreCompileJs ¶
func (g *GojaJsEngine) PreCompileJs(config Config) error
PreCompileJs Precompiled UDF JavaScript file
func (*GojaJsEngine) Stop ¶
func (g *GojaJsEngine) Stop()
type HTTPComponent ¶
type HTTPComponent struct {
// contains filtered or unexported fields
}
HTTPComponent HTTP请求组件
func NewHTTPComponent ¶
func NewHTTPComponent(config json.RawMessage) (*HTTPComponent, error)
func (*HTTPComponent) AnalyzeInputs ¶
func (c *HTTPComponent) AnalyzeInputs(ctx context.Context) (any, error)
func (*HTTPComponent) Validate ¶
func (c *HTTPComponent) Validate() []core.ValidationError
type HTTPConfig ¶
type HttpClient ¶
type HttpClient struct {
Timeout time.Duration
MaxRetries int
// contains filtered or unexported fields
}
func NewHttpClient ¶
func NewHttpClient(timeout time.Duration, maxRetries int) *HttpClient
NewHttpClient 复用单例 client
func (*HttpClient) DoRequest ¶
func (h *HttpClient) DoRequest(opts RequestOptions) (int, []byte, error)
DoRequest 复用 Request/Response
type RequestOptions ¶
type RequestOptions struct {
Method string
URL string
Headers map[string]string
Body interface{}
IsJSON bool
}
RequestOptions 请求选项
type Script ¶
type Script struct {
// Type is the script type, default is Js.
Type string
// Content is the script content or custom function.
Content interface{}
}
Script is used to register native functions or custom functions defined in Go.
type StartComponent ¶
type StartComponent struct {
}
StartComponent 启动组件
func NewStartComponent ¶
func NewStartComponent() (*StartComponent, error)
func (*StartComponent) AnalyzeInputs ¶
func (c *StartComponent) AnalyzeInputs(ctx context.Context) (any, error)
func (*StartComponent) Validate ¶
func (c *StartComponent) Validate() []core.ValidationError
Click to show internal directories.
Click to hide internal directories.