meta_info.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type StatusType string
  7. type SourceType string
  8. type MetaType string
  9. const (
  10. UserNoticeType MetaType = "USER_NOTICE"
  11. InitStatusType StatusType = "INIT"
  12. PendingStatusType StatusType = "PENDING"
  13. FinishStatusType StatusType = "FINISH"
  14. FailedStatusType StatusType = "FAILED"
  15. ReportSourceType SourceType = "REPORT"
  16. VideoSourceType SourceType = "VIDEO"
  17. AudioSourceType SourceType = "AUDIO"
  18. )
  19. // MetaInfo 表示 meta_infos 表的模型
  20. type MetaInfo struct {
  21. Id int `description:"id"`
  22. Meta string `description:"meta"`
  23. From string `description:"from"`
  24. To string `description:"column:to"`
  25. SourceType SourceType `description:"source_type"`
  26. MetaType MetaType `gorm:"column:meta_type;type:enum('USER_NOTICE')"`
  27. Status StatusType `gorm:"column:status;type:enum('INIT','PENDING','FINISH','FAILED')"`
  28. CreatedTime time.Time
  29. UpdatedTime time.Time
  30. }
  31. type MetaData struct {
  32. SourceId int `json:"reportId"`
  33. AuthorId int `json:"AuthorId"`
  34. AuthorName string `json:"authorName"`
  35. PublishedTime string `json:"publishedTime"`
  36. }
  37. func (m *MetaInfo) TableName() string {
  38. return "meta_infos"
  39. }
  40. func (m *MetaInfo) Insert() (insert int64, err error) {
  41. o := orm.NewOrm()
  42. insert, err = o.Insert(m)
  43. return
  44. }