service.go 526 B

1234567891011121314151617181920212223242526272829
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/interface/main/shorturl/conf"
  5. shortdao "go-common/app/interface/main/shorturl/dao"
  6. "go-common/library/log"
  7. )
  8. // Service service struct
  9. type Service struct {
  10. shortd *shortdao.Dao
  11. }
  12. // New new service
  13. func New(c *conf.Config) (s *Service) {
  14. s = &Service{
  15. shortd: shortdao.New(c),
  16. }
  17. return
  18. }
  19. // Ping ping service.
  20. func (s *Service) Ping(c context.Context) (err error) {
  21. if err = s.shortd.Ping(c); err != nil {
  22. log.Error("s.dao.Ping error(%v)", err)
  23. }
  24. return
  25. }