dao_test.go 410 B

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