dao.go 772 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package search
  2. import (
  3. "context"
  4. "go-common/app/interface/main/creative/conf"
  5. "go-common/library/database/elastic"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. // Dao is search dao.
  9. type Dao struct {
  10. c *conf.Config
  11. // http client
  12. client *bm.Client
  13. // searchURI string
  14. // memberURI string
  15. es *elastic.Elastic
  16. }
  17. // New new a search dao.
  18. func New(c *conf.Config) (d *Dao) {
  19. d = &Dao{
  20. c: c,
  21. // client
  22. client: bm.NewClient(c.HTTPClient.Slow),
  23. // uri
  24. // searchURI: c.Host.Search + _spaceURL,
  25. // memberURI: c.Host.Search + _memberURL,
  26. es: elastic.NewElastic(&elastic.Config{
  27. Host: c.Host.MainSearch,
  28. HTTPClient: c.HTTPClient.Slow,
  29. }),
  30. }
  31. return d
  32. }
  33. // Ping ping success.
  34. func (d *Dao) Ping(c context.Context) (err error) {
  35. return
  36. }