dao.go 664 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package xanchor
  2. import (
  3. "context"
  4. xanchor "go-common/app/service/live/dao-anchor/api/grpc/v1"
  5. "go-common/app/service/live/xuser/conf"
  6. )
  7. // Dao dao
  8. type Dao struct {
  9. c *conf.Config
  10. xuserGRPC *xanchor.Client
  11. }
  12. var _rsCli *xanchor.Client
  13. // New init mysql db
  14. func New(c *conf.Config) (dao *Dao) {
  15. var err error
  16. if _rsCli, err = xanchor.NewClient(c.XanchorClient); err != nil {
  17. panic(err)
  18. }
  19. dao = &Dao{
  20. c: c,
  21. xuserGRPC: _rsCli,
  22. }
  23. return
  24. }
  25. // Close close the resource.
  26. func (d *Dao) Close() {
  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. // check
  32. return nil
  33. }