dao_test.go 413 B

123456789101112131415161718192021222324252627282930
  1. package thirdp
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "go-common/app/interface/main/tv/conf"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. var (
  10. d *Dao
  11. ctx = context.Background()
  12. )
  13. func init() {
  14. dir, _ := filepath.Abs("../../cmd/tv-interface.toml")
  15. flag.Set("conf", dir)
  16. conf.Init()
  17. d = New(conf.Conf)
  18. }
  19. func WithDao(f func(d *Dao)) func() {
  20. return func() {
  21. Reset(func() {})
  22. f(d)
  23. }
  24. }