service.go 672 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package income
  2. import (
  3. "context"
  4. "go-common/app/admin/main/growup/conf"
  5. upD "go-common/app/admin/main/growup/dao"
  6. incomeD "go-common/app/admin/main/growup/dao/income"
  7. "go-common/app/admin/main/growup/dao/message"
  8. )
  9. // Service struct
  10. type Service struct {
  11. conf *conf.Config
  12. dao *incomeD.Dao
  13. msg *message.Dao
  14. upDao *upD.Dao
  15. }
  16. // New fn
  17. func New(c *conf.Config) (s *Service) {
  18. s = &Service{
  19. conf: c,
  20. dao: incomeD.New(c),
  21. msg: message.New(c),
  22. upDao: upD.New(c),
  23. }
  24. return s
  25. }
  26. // Ping check dao health.
  27. func (s *Service) Ping(c context.Context) (err error) {
  28. return s.dao.Ping(c)
  29. }
  30. // Close dao
  31. func (s *Service) Close() {
  32. s.dao.Close()
  33. }