client.go 1.3 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 testdata
  5. import (
  6. "go-common/library/net/rpc/liverpc"
  7. "go-common/library/net/rpc/liverpc/testdata/v1"
  8. "go-common/library/net/rpc/liverpc/testdata/v2"
  9. )
  10. // Client that represents a liverpc room service api
  11. type Client struct {
  12. cli *liverpc.Client
  13. // V1Room presents the controller in liverpc
  14. V1Room v1.RoomRPCClient
  15. // V2Room presents the controller in liverpc
  16. V2Room v2.RoomRPCClient
  17. }
  18. // DiscoveryAppId the discovery id is not the tree name
  19. var DiscoveryAppId = "live.room"
  20. // New a Client that represents a liverpc live.room 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.V1Room = v1.NewRoomRPCClient(realCli)
  39. cli.V2Room = v2.NewRoomRPCClient(realCli)
  40. }