提交kit/flow

Signed-off-by: lixxxww <941403820@qq.com>
This commit is contained in:
lixxxww
2024-01-23 11:32:00 +00:00
committed by Gitee
parent 731f8224b0
commit a329e336e0
3 changed files with 115 additions and 0 deletions

33
kit/flow/edge.go Normal file
View File

@@ -0,0 +1,33 @@
package flow
import "pandax/kit/utils"
type Edge struct {
Id string `json:"id"`
Type string `json:"type"`
SourceNodeId string `json:"sourceNodeId"` //当前节点
TargetNodeId string `json:"targetNodeId"` //下一节点
StartPoint Point `json:"startPoint"`
EndPoint Point `json:"endPoint"`
Properties Properties `json:"properties"`
PointsList []Point `json:"pointsList"`
}
type Point struct {
X int `json:"x"`
Y int `json:"y"`
}
func (edge *Edge) getTargetNode(sourceNodeId string) string {
if edge.SourceNodeId == sourceNodeId {
return edge.TargetNodeId
}
return ""
}
func (edge *Edge) GetProperties(data any) error {
if err := utils.Map2Struct(edge.Properties, data); err != nil {
return err
}
return nil
}