dao.go 778 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package dao
  2. import (
  3. "context"
  4. accrpc "go-common/app/service/main/account/rpc/client"
  5. "go-common/app/interface/live/web-room/conf"
  6. "go-common/app/service/live/xuser/api/grpc/v1"
  7. )
  8. // Dao dao
  9. type Dao struct {
  10. c *conf.Config
  11. RoomAdminAPI v1.RoomAdminClient
  12. acc *accrpc.Service3
  13. }
  14. // New init mysql db
  15. func New(c *conf.Config) (dao *Dao) {
  16. roomAdminClient, err := v1.NewXuserRoomAdminClient(conf.Conf.XRoomAdmin)
  17. if err != nil {
  18. panic(err)
  19. }
  20. dao = &Dao{
  21. c: c,
  22. RoomAdminAPI: roomAdminClient,
  23. acc: accrpc.New3(c.AccountRPC),
  24. }
  25. return
  26. }
  27. // Close close the resource.
  28. func (d *Dao) Close() {
  29. }
  30. // Ping dao ping
  31. func (d *Dao) Ping(c context.Context) error {
  32. // TODO: if you need use mc,redis, please add
  33. return nil
  34. }