package flow import ( "git.sxidc.com/go-tools/utils/pipeline/component" "git.sxidc.com/go-tools/utils/strutils" "github.com/pkg/errors" ) type SubComponentBuildParams struct { Type string `mapstructure:"type" structs:"type"` Name string `mapstructure:"name" structs:"name"` BuildParams map[string]any `mapstructure:"build_params" structs:"build_params"` RunParams map[string]any `mapstructure:"run_params" structs:"run_params"` } func (params *SubComponentBuildParams) Check(parentNodeType string) error { if strutils.IsStringEmpty(params.Type) { return errors.New(parentNodeType + "没有传递子节点类型") } if strutils.IsStringEmpty(params.Name) { return errors.New(parentNodeType + "没有传递子节点名称") } return nil } func (params *SubComponentBuildParams) BuildComponent() (component.Component, error) { return component.BuildComponent(params.Type, params.Name, params.BuildParams, params.RunParams) }