dao.go 804 B

12345678910111213141516171819202122232425262728293031323334
  1. package dataplatform
  2. import (
  3. "go-common/app/job/main/growup/conf"
  4. "go-common/library/database/sql"
  5. xhttp "go-common/library/net/http/blademaster"
  6. )
  7. // Dao is redis dao.
  8. type Dao struct {
  9. c *conf.Config
  10. db *sql.DB
  11. url string
  12. spyURL string
  13. bgmURL string
  14. basicURL string
  15. client *xhttp.Client
  16. }
  17. // New is new redis dao.
  18. func New(c *conf.Config) (d *Dao) {
  19. d = &Dao{
  20. c: c,
  21. db: sql.NewMySQL(c.Mysql.Growup),
  22. // client
  23. client: xhttp.NewClient(c.DPClient),
  24. url: c.Host.DataPlatform + "/avenger/api/38/query",
  25. spyURL: c.Host.DataPlatform + "/avenger/api/51/query",
  26. // bgmURL: c.Host.DataPlatform + "/avenger/api/81/query",
  27. bgmURL: c.Host.DataPlatform + "/avenger/api/95/query",
  28. basicURL: c.Host.DataPlatform + "/avenger/api/200/query",
  29. }
  30. return
  31. }