task.go 820 B

1234567891011121314151617181920
  1. package model
  2. import (
  3. "time"
  4. "gorm.io/datatypes"
  5. )
  6. type Task struct {
  7. ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
  8. TaskType string `gorm:"type:enum('full','discover','search','github','scrape','crawl','clean','score');not null;index" json:"task_type"`
  9. Status string `gorm:"type:enum('pending','running','completed','failed','stopped');default:'pending';index" json:"status"`
  10. Params datatypes.JSON `gorm:"type:json" json:"params"`
  11. Progress datatypes.JSON `gorm:"type:json" json:"progress"`
  12. Result datatypes.JSON `gorm:"type:json" json:"result"`
  13. ErrorMsg string `gorm:"type:text" json:"error_msg"`
  14. StartedAt *time.Time `json:"started_at"`
  15. FinishedAt *time.Time `json:"finished_at"`
  16. CreatedAt time.Time `json:"created_at"`
  17. }