base_model.go 725 B

12345678910111213141516171819202122
  1. package model
  2. import (
  3. "gorm.io/gorm"
  4. "time"
  5. )
  6. type BaseModel struct {
  7. ID int `json:"id" form:"id" gorm:"primaryKey"`
  8. CreateAt time.Time `json:"-" gorm:"autoCreateTime"` //标签autoCreateTime设置如果字段名字不为CreatAt时候自动插入当前时间
  9. UpdateAt time.Time `json:"-" gorm:"autoUpdateTime"`
  10. DeletedAt gorm.DeletedAt `json:"-" gorm:"column:delete_at"`
  11. }
  12. const (
  13. UserDocStatus_Normal = 0 //文件正常
  14. UserDocStatus_LogicDelete = 1 //删除
  15. UserDocStatus_PermanentlyDelete = 2 //永久删除
  16. UserDocCategory_SelfUpload = 0 //自己上传
  17. UserDocCategory_Download = 1 //转存(下载)
  18. UserDocCategory_Collect = 2 //收藏
  19. )