ping.go 563 B

12345678910111213141516171819202122232425262728293031
  1. package ping
  2. import (
  3. "context"
  4. "go-common/app/interface/main/app-feed/conf"
  5. arcdao "go-common/app/interface/main/app-feed/dao/archive"
  6. adtdao "go-common/app/interface/main/app-feed/dao/audit"
  7. )
  8. type Service struct {
  9. arcDao *arcdao.Dao
  10. adtDao *adtdao.Dao
  11. }
  12. func New(c *conf.Config) (s *Service) {
  13. s = &Service{
  14. arcDao: arcdao.New(c),
  15. adtDao: adtdao.New(c),
  16. }
  17. return
  18. }
  19. // Ping is check server ping.
  20. func (s *Service) Ping(c context.Context) (err error) {
  21. if err = s.adtDao.PingDB(c); err != nil {
  22. return
  23. }
  24. err = s.arcDao.PingMC(c)
  25. return
  26. }