dao.go 432 B

123456789101112131415161718192021222324
  1. package cms
  2. import (
  3. "go-common/app/job/main/tv/conf"
  4. "go-common/library/database/sql"
  5. httpx "go-common/library/net/http/blademaster"
  6. )
  7. // Dao dao.
  8. type Dao struct {
  9. conf *conf.Config
  10. DB *sql.DB
  11. client *httpx.Client
  12. }
  13. // New create a instance of Dao and return.
  14. func New(c *conf.Config) (d *Dao) {
  15. d = &Dao{
  16. conf: c,
  17. DB: sql.NewMySQL(c.Mysql),
  18. client: httpx.NewClient(conf.Conf.HTTPClient),
  19. }
  20. return
  21. }