meta_info.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. Uid string `description:"uid"`
  23. Meta string `description:"meta"`
  24. From string `description:"from"`
  25. To string `description:"column:to"`
  26. SourceType SourceType `description:"source_type"`
  27. MetaType MetaType `gorm:"column:meta_type;type:enum('USER_NOTICE')"`
  28. Status StatusType `gorm:"column:status;type:enum('INIT','PENDING','FINISH','FAILED')"`
  29. CreatedTime time.Time
  30. UpdatedTime time.Time
  31. }
  32. type MetaData struct {
  33. SourceId int `json:"reportId"`
  34. AuthorId int `json:"AuthorId"`
  35. AuthorName string `json:"authorName"`
  36. PublishedTime string `json:"publishedTime"`
  37. }
  38. func (m *MetaInfo) TableName() string {
  39. return "meta_infos"
  40. }
  41. func (m *MetaInfo) Insert() (insert int64, err error) {
  42. o := orm.NewOrm()
  43. insert, err = o.Insert(m)
  44. return
  45. }