dao_test.go 342 B

12345678910111213141516171819202122232425
  1. package playurl
  2. import (
  3. "context"
  4. "flag"
  5. "go-common/app/job/main/tv/conf"
  6. "path/filepath"
  7. )
  8. var (
  9. ctx = context.TODO()
  10. d *Dao
  11. )
  12. func WithDao(f func(d *Dao)) func() {
  13. return func() {
  14. dir, _ := filepath.Abs("../../cmd/tv-job-test.toml")
  15. flag.Set("conf", dir)
  16. conf.Init()
  17. if d == nil {
  18. d = New(conf.Conf)
  19. }
  20. f(d)
  21. }
  22. }