client.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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/live_data/api/liverpc/v0"
  7. "go-common/app/service/live/live_data/api/liverpc/v1"
  8. "go-common/library/net/rpc/liverpc"
  9. )
  10. // Client that represents a liverpc live_data service api
  11. type Client struct {
  12. cli *liverpc.Client
  13. // V0Message presents the controller in liverpc
  14. V0Message v0.Message
  15. // V1Record presents the controller in liverpc
  16. V1Record v1.Record
  17. }
  18. // DiscoveryAppId the discovery id is not the tree name
  19. var DiscoveryAppId = "live.livedata"
  20. // New a Client that represents a liverpc live.livedata service api
  21. // conf can be empty, and it will use discovery to find service by default
  22. // conf.AppID will be overwrite by a fixed value DiscoveryAppId
  23. // therefore is no need to set
  24. func New(conf *liverpc.ClientConfig) *Client {
  25. if conf == nil {
  26. conf = &liverpc.ClientConfig{}
  27. }
  28. conf.AppID = DiscoveryAppId
  29. var realCli = liverpc.NewClient(conf)
  30. cli := &Client{cli: realCli}
  31. cli.clientInit(realCli)
  32. return cli
  33. }
  34. func (cli *Client) GetRawCli() *liverpc.Client {
  35. return cli.cli
  36. }
  37. func (cli *Client) clientInit(realCli *liverpc.Client) {
  38. cli.V0Message = v0.NewMessageRpcClient(realCli)
  39. cli.V1Record = v1.NewRecordRpcClient(realCli)
  40. }