service.go 495 B

12345678910111213141516171819202122232425262728293031323334
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/interface/main/up-rating/conf"
  5. "go-common/app/interface/main/up-rating/dao"
  6. )
  7. // Service is up-dao service
  8. type Service struct {
  9. conf *conf.Config
  10. // dao dao
  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. return s
  20. }
  21. // Ping fn
  22. func (s *Service) Ping(c context.Context) (err error) {
  23. return s.dao.Ping(c)
  24. }
  25. // Close dao
  26. func (s *Service) Close() {
  27. s.dao.Close()
  28. }