model.go 749 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package entity
  2. import "gorm.io/gorm"
  3. const (
  4. ModelPrefix = "magic_"
  5. SysModelPrefix = "sys_"
  6. )
  7. type Member struct {
  8. ID int64
  9. OpenID string
  10. }
  11. type MysqlIdModel struct {
  12. Id int64 `json:"id" gorm:"primarykey;comment:id"`
  13. }
  14. //db.Exec("ALTER TABLE your_table_name AUTO_INCREMENT = 1000")
  15. type MysqlTimeModel struct {
  16. CreatedAt int64 `json:"created_at,omitempty" gorm:"autoCreateTime;comment:创建时间"`
  17. UpdatedAt int64 `json:"updated_at,omitempty" gorm:"autoUpdateTime;comment:更新时间"`
  18. }
  19. type MysqlDeleteModel struct {
  20. DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间"`
  21. }
  22. type MysqlBaseModel struct {
  23. MysqlIdModel
  24. MysqlTimeModel
  25. }
  26. type MysqlFullModel struct {
  27. MysqlIdModel
  28. MysqlTimeModel
  29. MysqlDeleteModel
  30. }