Files
PandaX/kit/flow/node.go
勤快的小晴同学 0d3bae0001 部分判断优化
Signed-off-by: 勤快的小晴同学 <941403820@qq.com>
2024-03-11 01:50:13 +00:00

40 lines
738 B
Go

package flow
import (
"pandax/kit/utils"
)
type Properties map[string]any
type Node struct {
Id string `json:"id"`
Type string `json:"type"`
X int `json:"x"`
Y int `json:"y"`
Text Text `json:"text"`
Properties Properties `json:"properties"`
}
type Text struct {
X int `json:"x"`
Y int `json:"y"`
Value string `json:"value"`
}
func (node *Node) IsStartNode(ty string) bool {
return node.Type == ty
}
func (node *Node) GetProperties(data any) error {
if err := utils.Map2Struct(node.Properties, data); err != nil {
return err
}
return nil
}
type NodeFunc func(*Node)
func (node *Node) RunNodeFunc(nodeFunc NodeFunc) {
nodeFunc(node)
}