dao.go 660 B

123456789101112131415161718192021222324252627282930313233
  1. package videoup
  2. import (
  3. "go-common/app/admin/main/mcn/conf"
  4. "go-common/app/service/main/videoup/model/archive"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. const (
  8. _typeURL = "/videoup/types"
  9. )
  10. // Dao .
  11. type Dao struct {
  12. c *conf.Config
  13. client *bm.Client
  14. videTypeURL string
  15. videoUpTypeCache map[int]archive.Type
  16. }
  17. // New new a Dao and return.
  18. func New(c *conf.Config) (d *Dao) {
  19. d = &Dao{
  20. c: c,
  21. // http client
  22. client: bm.NewClient(c.HTTPClient),
  23. videTypeURL: c.Host.Videoup + _typeURL,
  24. videoUpTypeCache: make(map[int]archive.Type),
  25. }
  26. d.refreshUpType()
  27. go d.refreshUpTypeAsync()
  28. return
  29. }