model.go 751 B

123456789101112131415161718192021222324252627
  1. package common
  2. import (
  3. "gorm.io/gorm"
  4. "time"
  5. )
  6. type Model struct {
  7. ID int `json:"id" gorm:"primaryKey;autoIncrement;comment:主键编码"`
  8. }
  9. type ModelTime struct {
  10. CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"`
  11. UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"`
  12. DeletedAt gorm.DeletedAt `json:"-" gorm:"index;comment:删除时间"`
  13. }
  14. type YearMonthWeek struct {
  15. Year int `json:"year" form:"year" gorm:"comment:年"`
  16. Month int `json:"month" form:"month" gorm:"comment:月"`
  17. Week int `json:"week" form:"week" gorm:"comment:周"`
  18. }
  19. type ControlBy struct {
  20. CreateBy int `json:"createBy" gorm:"index;comment:创建者"`
  21. UpdateBy int `json:"updateBy" gorm:"index;comment:更新者"`
  22. }