dao_test.go 308 B

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