dao.go 666 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package xuser
  2. import (
  3. "context"
  4. "go-common/app/interface/live/app-interface/conf"
  5. xuser "go-common/app/service/live/xuser/api/grpc/v1"
  6. )
  7. // Dao dao
  8. type Dao struct {
  9. c *conf.Config
  10. xuserGRPC *xuser.Client
  11. }
  12. var _rsCli *xuser.Client
  13. // New init mysql db
  14. func New(c *conf.Config) (dao *Dao) {
  15. var err error
  16. if _rsCli, err = xuser.NewClient(c.XuserClient); 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. return
  28. }
  29. // Ping dao ping
  30. func (d *Dao) Ping(c context.Context) error {
  31. // TODO: if you need use mc,redis, please add
  32. // check
  33. return nil
  34. }