You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
592 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. package config
  2. import (
  3. "git.aiterp.net/lucifer/new-server/internal/mysql"
  4. "git.aiterp.net/lucifer/new-server/models"
  5. )
  6. var (
  7. bRepo models.BridgeRepository
  8. dRepo models.DeviceRepository
  9. ehRepo models.EventHandlerRepository
  10. )
  11. func BridgeRepository() models.BridgeRepository {
  12. if bRepo == nil {
  13. bRepo = &mysql.BridgeRepo{DBX: DBX()}
  14. }
  15. return bRepo
  16. }
  17. func DeviceRepository() models.DeviceRepository {
  18. if dRepo == nil {
  19. panic("panik")
  20. }
  21. return dRepo
  22. }
  23. func EventHandlerRepository() models.EventHandlerRepository {
  24. if ehRepo == nil {
  25. panic("panik")
  26. }
  27. return ehRepo
  28. }