service.go 575 B

1234567891011121314151617181920212223242526272829303132
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/admin/main/search/conf"
  5. "go-common/app/admin/main/search/dao"
  6. "go-common/app/admin/main/search/model"
  7. )
  8. // Service struct of service.
  9. type Service struct {
  10. c *conf.Config
  11. dao *dao.Dao
  12. queryConf map[string]*model.QueryConfDetail
  13. }
  14. // New create service instance and return.
  15. func New(c *conf.Config) (s *Service) {
  16. s = &Service{
  17. c: c,
  18. dao: dao.New(c),
  19. }
  20. s.loadQueryConf()
  21. go s.loadQueryConfproc()
  22. return
  23. }
  24. // Ping .
  25. func (s *Service) Ping(c context.Context) error {
  26. return s.dao.Ping(c)
  27. }