all.go 658 B

123456789101112131415161718192021222324252627282930
  1. package model
  2. import "github.com/jinzhu/gorm"
  3. // All 导出
  4. type All struct {
  5. Product *Product
  6. Vendor *Vendor
  7. User *User
  8. Application *Application
  9. Protocal *Protocal
  10. Sensor *Sensor
  11. Alert *Alert
  12. Device *Device
  13. Role *Role
  14. }
  15. // Init 初始化所有model
  16. func (a *All) Init(db *gorm.DB) *All {
  17. a.Product = new(Product).Init(db)
  18. a.Vendor = new(Vendor).Init(db)
  19. a.User = new(User).Init(db)
  20. a.Application = new(Application).Init(db)
  21. a.Protocal = new(Protocal).Init(db)
  22. a.Sensor = new(Sensor).Init(db)
  23. a.Alert = new(Alert).Init(db)
  24. a.Device = new(Device).Init(db)
  25. a.Role = new(Role).Init(db)
  26. return a
  27. }