dao.go 782 B

12345678910111213141516171819202122232425262728293031323334
  1. package pgc
  2. import (
  3. "go-common/app/admin/main/feed/conf"
  4. epgrpc "go-common/app/service/openplatform/pgc-season/api/grpc/episode/v1"
  5. seasongrpc "go-common/app/service/openplatform/pgc-season/api/grpc/season/v1"
  6. "go-common/library/log"
  7. )
  8. // Dao is show dao.
  9. type Dao struct {
  10. // grpc
  11. rpcClient seasongrpc.SeasonClient
  12. epClient epgrpc.EpisodeClient
  13. }
  14. // New new a bangumi dao.
  15. func New(c *conf.Config) (*Dao, error) {
  16. var ep epgrpc.EpisodeClient
  17. rpcClient, err := seasongrpc.NewClient(nil)
  18. if err != nil {
  19. log.Error("seasongrpc NewClientt error(%v)", err)
  20. return nil, err
  21. }
  22. if ep, err = epgrpc.NewClient(nil); err != nil {
  23. log.Error("eprpc NewClientt error(%v)", err)
  24. return nil, err
  25. }
  26. d := &Dao{
  27. rpcClient: rpcClient,
  28. epClient: ep,
  29. }
  30. return d, nil
  31. }