by.go 780 B

1234567891011121314151617181920212223242526272829303132
  1. package models
  2. import (
  3. "time"
  4. "gorm.io/gorm"
  5. )
  6. type ControlBy struct {
  7. CreateBy string `json:"createBy" gorm:"index;comment:创建者"`
  8. UpdateBy string `json:"updateBy" gorm:"index;comment:更新者"`
  9. }
  10. // SetCreateBy 设置创建人id
  11. func (e *ControlBy) SetCreateBy(createBy string) {
  12. e.CreateBy = createBy
  13. }
  14. // SetUpdateBy 设置修改人id
  15. func (e *ControlBy) SetUpdateBy(updateBy string) {
  16. e.UpdateBy = updateBy
  17. }
  18. type Model struct {
  19. Id string `json:"id" gorm:"primaryKey;autoIncrement;comment:主键编码"`
  20. }
  21. type ModelTime struct {
  22. CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"`
  23. UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"`
  24. DeletedAt gorm.DeletedAt `json:"-" gorm:"index;comment:删除时间"`
  25. }