RuleGo RuleGo
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • RuleGo-MCP-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • RuleGo-MCP-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文

广告采用随机轮播方式显示 ❤️成为赞助商
  • Quick Start

  • Rule Chain

  • Standard Components

  • Extension Components

  • Custom Components

  • Components marketplace

  • Visualization

    • Visualization Overview
    • RuleGo-Editor
    • Get Component Configuration Forms
    • Get Rule Chain Configuration
    • Get Rule Chain Node Configuration
    • Batch Initialize Rule Chain
    • Delete Rule Chain Instance
    • Save Rule Chain Coordinate Information
    • Component Form Conventions
    • AOP

    • Trigger

    • Advanced Topic

    • RuleGo-Server

    • FAQ

    • Endpoint Module

    • Support

    目录

    Component Form Conventions

    The framework will scan the registered components and generate component form configurations according to the following conventions, which are used for rendering component configuration forms in the visual editor.

    1. Generate a component name (lowercase first letter) based on the component structure name
    2. Generate form items based on the structure defined by the Config field of the component structure. (The first letter of the field is lowercase or customized through json tag)
    3. Generate default values for form items based on the Config field of the component instance returned by the New() method
    4. Generate categories based on component package names. The component categories are: transform action、filter、external、flow、ci、ai、aiot
    5. The endpoint component type is prefixed with endpoint/

    TIP

    Components can implement the following optional interface to override the definitions from the Component Configuration Form Conventions :

    type ComponentDefGetter interface {
      Def() ComponentForm
    }
    
    1
    2
    3

    # Example

    Component definition:

    // JsTransformNodeConfiguration node configuration, generates form items for exportable fields
    type JsTransformNodeConfiguration struct {
        JsScript string
    }
    
    // JsTransformNode is the custom component struct, corresponding to the generated component name: jsTransformNode
    type JsTransformNode struct {
      // Node configuration, If the node requires form configuration, it must have a `Config` field.
      Config   JsTransformNodeConfiguration
      jsEngine types.JsEngine
    }
    // Type function returns the type of the component
    func (x *JsTransformNode) Type() string {
    return "jsTransform"
    }
    // New function initializes based on the Config field, obtaining the default values for form items
    func (x *JsTransformNode) New() types.Node {
    return &JsTransformNode{Config: JsTransformNodeConfiguration{
    JsScript: "return {'msg':msg,'metadata':metadata,'msgType':msgType};",
    }}
    }
    // Other interfaces are not shown here
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22

    Automatically generate component configuration form definition:

    {
          "type": "jsTransform",
          "category": "transform",
          "fields": [
            {
              "name": "jsScript",
              "type": "string",
              "defaultValue": "return {'msg':msg,'metadata':metadata,'msgType':msgType};",
              "label": "",
              "desc": "",
              "validate": "",
              "fields": null
            }
          ],
          "label": "JsTransformNode",
          "desc": "",
          "icon": "",
          "relationTypes": [
            "Success",
            "Failure"
          ]
        }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    • Component Configuration Form Definition
    • You can make international settings for component configuration in the RuleGo-Editor visual editor local_zh.js file.
    Edit this page on GitHub (opens new window)
    Last Updated: 2025/04/02, 01:29:50
    Save Rule Chain Coordinate Information
    AOP Overview

    ← Save Rule Chain Coordinate Information AOP Overview→

    Theme by Vdoing | Copyright © 2023-2025 RuleGo Team | Apache 2.0 License

    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式