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.

45 lines
800 B

4 years ago
4 years ago
4 years ago
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. cpRepo models.ColorPresetRepository
  9. dRepo models.DeviceRepository
  10. ehRepo models.EventHandlerRepository
  11. )
  12. func BridgeRepository() models.BridgeRepository {
  13. if bRepo == nil {
  14. bRepo = &mysql.BridgeRepo{DBX: DBX()}
  15. }
  16. return bRepo
  17. }
  18. func ColorPresetRepository() models.ColorPresetRepository {
  19. if cpRepo == nil {
  20. cpRepo = &mysql.ColorPresetRepo{DBX: DBX()}
  21. }
  22. return cpRepo
  23. }
  24. func DeviceRepository() models.DeviceRepository {
  25. if dRepo == nil {
  26. dRepo = &mysql.DeviceRepo{DBX: DBX()}
  27. }
  28. return dRepo
  29. }
  30. func EventHandlerRepository() models.EventHandlerRepository {
  31. if ehRepo == nil {
  32. panic("panik")
  33. }
  34. return ehRepo
  35. }