client.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Code generated by liverpcgen, DO NOT EDIT.
  2. // source: *.proto files under this directory
  3. // If you want to change this file, Please see README in go-common/app/tool/liverpc/protoc-gen-liverpc/
  4. package liverpc
  5. import (
  6. "go-common/app/service/live/relation/api/liverpc/v1"
  7. "go-common/app/service/live/relation/api/liverpc/v2"
  8. "go-common/library/net/rpc/liverpc"
  9. )
  10. // Client that represents a liverpc relation service api
  11. type Client struct {
  12. cli *liverpc.Client
  13. // V1App presents the controller in liverpc
  14. V1App v1.App
  15. // V1BaseInfo presents the controller in liverpc
  16. V1BaseInfo v1.BaseInfo
  17. // V1Feed presents the controller in liverpc
  18. V1Feed v1.Feed
  19. // V2App presents the controller in liverpc
  20. V2App v2.App
  21. }
  22. // DiscoveryAppId the discovery id is not the tree name
  23. var DiscoveryAppId = "live.relation"
  24. // New a Client that represents a liverpc live.relation service api
  25. // conf can be empty, and it will use discovery to find service by default
  26. // conf.AppID will be overwrite by a fixed value DiscoveryAppId
  27. // therefore is no need to set
  28. func New(conf *liverpc.ClientConfig) *Client {
  29. if conf == nil {
  30. conf = &liverpc.ClientConfig{}
  31. }
  32. conf.AppID = DiscoveryAppId
  33. var realCli = liverpc.NewClient(conf)
  34. cli := &Client{cli: realCli}
  35. cli.clientInit(realCli)
  36. return cli
  37. }
  38. func (cli *Client) GetRawCli() *liverpc.Client {
  39. return cli.cli
  40. }
  41. func (cli *Client) clientInit(realCli *liverpc.Client) {
  42. cli.V1App = v1.NewAppRpcClient(realCli)
  43. cli.V1BaseInfo = v1.NewBaseInfoRpcClient(realCli)
  44. cli.V1Feed = v1.NewFeedRpcClient(realCli)
  45. cli.V2App = v2.NewAppRpcClient(realCli)
  46. }