dao_test.go 310 B

12345678910111213141516171819202122
  1. package job
  2. import (
  3. "flag"
  4. "path/filepath"
  5. "go-common/app/interface/main/web-show/conf"
  6. )
  7. var d *Dao
  8. func WithDao(f func(d *Dao)) func() {
  9. return func() {
  10. dir, _ := filepath.Abs("../cmd/web-show-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. }