all.go 502 B

123456789101112131415161718192021222324
  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. Alert *Alert
  11. }
  12. // Init 初始化所有model
  13. func (a *All) Init(db *gorm.DB) *All {
  14. a.Product = new(Product).Init(db)
  15. a.Vendor = new(Vendor).Init(db)
  16. a.User = new(User).Init(db)
  17. a.Application = new(Application).Init(db)
  18. a.Protocal = new(Protocal).Init(db)
  19. a.Alert = new(Alert).Init(db)
  20. return a
  21. }