dao.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/job/main/account-summary/conf"
  5. member "go-common/app/service/main/member/api/gorpc"
  6. relation "go-common/app/service/main/relation/rpc/client"
  7. "go-common/library/database/sql"
  8. bm "go-common/library/net/http/blademaster"
  9. "go-common/library/database/hbase.v2"
  10. )
  11. // Dao dao
  12. type Dao struct {
  13. c *conf.Config
  14. AccountSumHBase *hbase.Client
  15. MemberService *member.Service
  16. RelationService *relation.Service
  17. httpClient *bm.Client
  18. MemberDB *sql.DB
  19. RelationDB *sql.DB
  20. PassportDB *sql.DB
  21. }
  22. // New init mysql db
  23. func New(c *conf.Config) *Dao {
  24. dao := &Dao{
  25. c: c,
  26. AccountSumHBase: hbase.NewClient(c.AccountSummaryHBase),
  27. MemberService: member.New(c.MemberService),
  28. RelationService: relation.New(c.RelationService),
  29. httpClient: bm.NewClient(c.HTTPClient),
  30. MemberDB: sql.NewMySQL(c.MemberDB),
  31. RelationDB: sql.NewMySQL(c.RelationDB),
  32. PassportDB: sql.NewMySQL(c.PassportDB),
  33. }
  34. return dao
  35. }
  36. // Close close the resource.
  37. func (d *Dao) Close() {
  38. }
  39. // Ping dao ping
  40. func (d *Dao) Ping(ctx context.Context) error {
  41. return nil
  42. }