service.go 542 B

1234567891011121314151617181920212223242526272829303132333435
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/job/main/up-rating/conf"
  5. "go-common/app/job/main/up-rating/dao"
  6. "go-common/library/log"
  7. )
  8. // Service struct
  9. type Service struct {
  10. conf *conf.Config
  11. dao *dao.Dao
  12. }
  13. // New fn
  14. func New(c *conf.Config) (s *Service) {
  15. s = &Service{
  16. conf: c,
  17. dao: dao.New(c),
  18. }
  19. log.Info("service start")
  20. return s
  21. }
  22. // Ping check dao health.
  23. func (s *Service) Ping(c context.Context) (err error) {
  24. return s.dao.Ping(c)
  25. }
  26. // Close close the service
  27. func (s *Service) Close() {
  28. s.dao.Close()
  29. }