service.go 614 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/interface/bbq/video/internal/dao"
  5. "go-common/library/conf/paladin"
  6. )
  7. // Service service.
  8. type Service struct {
  9. ac *paladin.Map
  10. dao *dao.Dao
  11. }
  12. // New new a service and return.
  13. func New() (s *Service) {
  14. var ac = new(paladin.TOML)
  15. if err := paladin.Watch("application.toml", ac); err != nil {
  16. panic(err)
  17. }
  18. s = &Service{
  19. ac: ac,
  20. dao: dao.New(),
  21. }
  22. return s
  23. }
  24. // Ping ping the resource.
  25. func (s *Service) Ping(ctx context.Context) (err error) {
  26. return s.dao.Ping(ctx)
  27. }
  28. // Close close the resource.
  29. func (s *Service) Close() {
  30. s.dao.Close()
  31. }