You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

jobflow.go 4.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. package schsdk
  2. import (
  3. cdssdk "gitlink.org.cn/cloudream/common/sdks/storage"
  4. "time"
  5. )
  6. type FlowData struct {
  7. Nodes []Node `json:"nodes"`
  8. Edges []Edge `json:"edges"`
  9. }
  10. type Node struct {
  11. ID string `json:"id"`
  12. Type string `json:"type"`
  13. X float64 `json:"x"`
  14. Y float64 `json:"y"`
  15. Properties JobInfo `json:"properties"`
  16. Text *Text `json:"text,omitempty"` // 有些节点没有 text 字段
  17. }
  18. type Edge struct {
  19. ID string `json:"id"`
  20. Type string `json:"type"`
  21. Properties interface{} `json:"properties"` // 为空对象 {}
  22. SourceNodeID string `json:"sourceNodeId"`
  23. TargetNodeID string `json:"targetNodeId"`
  24. SourceAnchorID string `json:"sourceAnchorId"`
  25. TargetAnchorID string `json:"targetAnchorId"`
  26. StartPoint Point `json:"startPoint"`
  27. EndPoint Point `json:"endPoint"`
  28. PointsList []Point `json:"pointsList"`
  29. Text *Text `json:"text,omitempty"` // 有些 edge 有文字标签
  30. }
  31. type Point struct {
  32. X float64 `json:"x"`
  33. Y float64 `json:"y"`
  34. }
  35. type Text struct {
  36. X float64 `json:"x"`
  37. Y float64 `json:"y"`
  38. Value string `json:"value"`
  39. }
  40. type JobFlowDAO struct {
  41. ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
  42. UserID cdssdk.UserID `gorm:"column:user_id;not null" json:"userID"`
  43. Name string `gorm:"column:name;size:255;not null" json:"name"`
  44. Description string `gorm:"column:description;size:255" json:"description"`
  45. Content string `gorm:"column:content;type:text" json:"content"`
  46. Status string `gorm:"column:status;type:enum('pending','running','failed','success');default:'pending'" json:"status"`
  47. JobType string `gorm:"column:job_type;size:255" json:"jobType"`
  48. UpdatedAt time.Time `gorm:"column:update_at;autoUpdateTime" json:"updatedAt"`
  49. CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
  50. }
  51. type JobFlow struct {
  52. ID int64 `json:"id"`
  53. UserID cdssdk.UserID `json:"userID"`
  54. Name string `json:"name"`
  55. Description string `json:"description"`
  56. Content FlowData `json:"content"`
  57. Status string `json:"status"`
  58. JobType string `json:"jobType"`
  59. UpdatedAt time.Time `json:"updatedAt"`
  60. CreatedAt time.Time `json:"createdAt"`
  61. }
  62. type JobFlowRunStatus struct {
  63. RunID JobSetID `gorm:"column:run_id;primaryKey" json:"runID"`
  64. NodeType string `gorm:"column:node_type;size:100" json:"nodeType"`
  65. NodeID string `gorm:"column:node_id;size:255" json:"nodeID"`
  66. Status string `gorm:"column:status;type:enum('pending','running','fail','success')" json:"status"`
  67. RunOutput string `gorm:"column:run_output;type:text" json:"runOutput"`
  68. RunLog string `gorm:"column:run_log;type:text" json:"runLog"`
  69. }
  70. type JobFlowRunDAO struct {
  71. ID JobSetID `gorm:"column:id;primaryKey;" json:"runID"`
  72. UserID cdssdk.UserID `gorm:"column:user_id" json:"userID"`
  73. Name string `gorm:"column:name;size:255;not null" json:"name"`
  74. Description string `gorm:"column:description;size:255" json:"description"`
  75. Content string `gorm:"column:content;type:text" json:"content"`
  76. Status string `gorm:"column:status;type:enum('running','fail','success')" json:"status"`
  77. Token string `gorm:"column:token;size:255" json:"token"`
  78. CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
  79. FinishAt *time.Time `gorm:"column:finish_at" json:"finishedAt"`
  80. }
  81. type JobFlowRun struct {
  82. ID JobSetID `gorm:"column:id;primaryKey;" json:"runID"`
  83. UserID cdssdk.UserID `gorm:"column:user_id" json:"userID"`
  84. Name string `gorm:"column:name;size:255;not null" json:"name"`
  85. Description string `gorm:"column:description;size:255" json:"description"`
  86. Content FlowData `gorm:"column:content;type:text" json:"content"`
  87. Status string `gorm:"column:status;type:enum('running','fail','success')" json:"status"`
  88. Token string `gorm:"column:token;size:255" json:"token"`
  89. CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
  90. FinishAt *time.Time `gorm:"column:finish_at" json:"finishedAt"`
  91. }