package schsdk import ( cdssdk "gitlink.org.cn/cloudream/common/sdks/storage" "time" ) type FlowData struct { Nodes []Node `json:"nodes"` Edges []Edge `json:"edges"` } type Node struct { ID string `json:"id"` Type string `json:"type"` X float64 `json:"x"` Y float64 `json:"y"` Properties JobInfo `json:"properties"` Text *Text `json:"text,omitempty"` // 有些节点没有 text 字段 } type Edge struct { ID string `json:"id"` Type string `json:"type"` Properties interface{} `json:"properties"` // 为空对象 {} SourceNodeID string `json:"sourceNodeId"` TargetNodeID string `json:"targetNodeId"` SourceAnchorID string `json:"sourceAnchorId"` TargetAnchorID string `json:"targetAnchorId"` StartPoint Point `json:"startPoint"` EndPoint Point `json:"endPoint"` PointsList []Point `json:"pointsList"` Text *Text `json:"text,omitempty"` // 有些 edge 有文字标签 } type Point struct { X float64 `json:"x"` Y float64 `json:"y"` } type Text struct { X float64 `json:"x"` Y float64 `json:"y"` Value string `json:"value"` } type JobFlowDAO struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` UserID cdssdk.UserID `gorm:"column:user_id;not null" json:"userID"` Name string `gorm:"column:name;size:255;not null" json:"name"` Description string `gorm:"column:description;size:255" json:"description"` Content string `gorm:"column:content;type:text" json:"content"` Status string `gorm:"column:status;type:enum('pending','running','failed','success');default:'pending'" json:"status"` JobType string `gorm:"column:job_type;size:255" json:"jobType"` UpdatedAt time.Time `gorm:"column:update_at;autoUpdateTime" json:"updatedAt"` CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"` } type JobFlow struct { ID int64 `json:"id"` UserID cdssdk.UserID `json:"userID"` Name string `json:"name"` Description string `json:"description"` Content FlowData `json:"content"` Status string `json:"status"` JobType string `json:"jobType"` UpdatedAt time.Time `json:"updatedAt"` CreatedAt time.Time `json:"createdAt"` }