service.go 541 B

123456789101112131415161718192021222324252627282930313233
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/admin/main/laser/conf"
  5. "go-common/app/admin/main/laser/dao"
  6. )
  7. // Service struct
  8. type Service struct {
  9. conf *conf.Config
  10. dao *dao.Dao
  11. }
  12. // New is new instance
  13. func New(c *conf.Config) (s *Service) {
  14. s = &Service{
  15. conf: c,
  16. dao: dao.New(c),
  17. }
  18. return
  19. }
  20. // Ping is check dao connected
  21. func (s *Service) Ping(c context.Context) (err error) {
  22. return s.dao.Ping(c)
  23. }
  24. // Close is close dao connection
  25. func (s *Service) Close() (err error) {
  26. return s.dao.Close(context.TODO())
  27. }