dao.go 540 B

123456789101112131415161718192021222324252627282930313233343536
  1. package dao
  2. import (
  3. "context"
  4. "strings"
  5. "go-common/app/admin/main/upload/conf"
  6. "github.com/tsuna/gohbase"
  7. )
  8. // Dao dao
  9. type Dao struct {
  10. c *conf.Config
  11. hbase gohbase.AdminClient
  12. Bfs *Bfs
  13. }
  14. // New init mysql db
  15. func New(c *conf.Config) (dao *Dao) {
  16. dao = &Dao{
  17. c: c,
  18. hbase: gohbase.NewAdminClient(strings.Join(c.Hbase.Zookeeper.Addrs, ",")),
  19. Bfs: NewBfs(c),
  20. }
  21. return dao
  22. }
  23. // Close close the resource.
  24. func (d *Dao) Close() {
  25. }
  26. // Ping dao ping
  27. func (d *Dao) Ping(c context.Context) error {
  28. return nil
  29. }