material.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package music
  2. import (
  3. xtime "go-common/library/time"
  4. )
  5. // consts for workflow event
  6. // Material model is the model for music
  7. type Material struct {
  8. ID int64 `json:"id" gorm:"column:id"`
  9. Pid int64 `json:"pid" gorm:"column:pid"`
  10. Name string `json:"name" gorm:"column:name"`
  11. Index int64 `json:"index" gorm:"column:index"`
  12. State int8 `json:"state" gorm:"column:state"`
  13. CTime xtime.Time `json:"ctime" gorm:"column:ctime"`
  14. MTime xtime.Time `json:"mtime" gorm:"column:mtime"`
  15. }
  16. // TableName is used to identify table name in gorm
  17. func (Material) TableName() string {
  18. return "music_material"
  19. }
  20. // MaterialPager def.
  21. type MaterialPager struct {
  22. Items []*Material `json:"items"`
  23. Pager *Pager `json:"pager"`
  24. }
  25. // MaterialMixParent model is the model for music
  26. type MaterialMixParent struct {
  27. Material
  28. PName string `json:"p_name" gorm:"column:p_name"`
  29. }
  30. // TableName is used to identify table name in gorm
  31. func (MaterialMixParent) TableName() string {
  32. return "music_material"
  33. }
  34. // MaterialMixParentPager def.
  35. type MaterialMixParentPager struct {
  36. Items []*MaterialMixParent `json:"items"`
  37. Pager *Pager `json:"pager"`
  38. }
  39. // WithMaterial model is the model for music
  40. type WithMaterial struct {
  41. ID int64 `json:"id" gorm:"column:id"`
  42. Sid int64 `json:"sid" gorm:"column:sid"`
  43. Tid int64 `json:"tid" gorm:"column:tid"`
  44. State int8 `json:"state" gorm:"column:state"`
  45. Index int64 `json:"index" gorm:"column:index"`
  46. CTime xtime.Time `json:"ctime" gorm:"column:ctime"`
  47. MTime xtime.Time `json:"mtime" gorm:"column:mtime"`
  48. }
  49. // TableName is used to identify table name in gorm
  50. func (WithMaterial) TableName() string {
  51. return "music_with_material"
  52. }
  53. // WithMaterialPager def.
  54. type WithMaterialPager struct {
  55. Pager *Pager `json:"pager"`
  56. Items []*WithMaterial `json:"items"`
  57. }