Files
PandaX/kit/flow/edge.go
lixxxww a329e336e0 提交kit/flow
Signed-off-by: lixxxww <941403820@qq.com>
2024-01-23 11:32:00 +00:00

34 lines
791 B
Go

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
}