dao.go 683 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package migrate
  2. import (
  3. "context"
  4. "go-common/app/job/live/push-search/conf"
  5. "go-common/library/database/hbase.v2"
  6. "go-common/library/database/sql"
  7. )
  8. // Dao dao
  9. type Dao struct {
  10. c *conf.Config
  11. SearchHBase *hbase.Client
  12. RoomDb *sql.DB
  13. }
  14. // New init mysql db
  15. func NewMigrate(c *conf.Config) (dao *Dao) {
  16. dao = &Dao{
  17. c: c,
  18. SearchHBase: hbase.NewClient(&c.SearchHBase.Config),
  19. RoomDb: sql.NewMySQL(c.MySQL),
  20. }
  21. return
  22. }
  23. // Close close the resource.
  24. func (d *Dao) Close() {
  25. d.RoomDb.Close()
  26. return
  27. }
  28. // Ping dao ping
  29. func (d *Dao) Ping(c context.Context) error {
  30. // TODO: if you need use mc,redis, please add
  31. return nil
  32. }