go-common/app/service/live/relation/api/liverpc/client.go

53 lines
1.6 KiB
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
// Code generated by liverpcgen, DO NOT EDIT.
// source: *.proto files under this directory
// If you want to change this file, Please see README in go-common/app/tool/liverpc/protoc-gen-liverpc/
package liverpc
import (
"go-common/app/service/live/relation/api/liverpc/v1"
"go-common/app/service/live/relation/api/liverpc/v2"
"go-common/library/net/rpc/liverpc"
)
// Client that represents a liverpc relation service api
type Client struct {
cli *liverpc.Client
// V1App presents the controller in liverpc
V1App v1.App
// V1BaseInfo presents the controller in liverpc
V1BaseInfo v1.BaseInfo
// V1Feed presents the controller in liverpc
V1Feed v1.Feed
// V2App presents the controller in liverpc
V2App v2.App
}
// DiscoveryAppId the discovery id is not the tree name
var DiscoveryAppId = "live.relation"
// New a Client that represents a liverpc live.relation service api
// conf can be empty, and it will use discovery to find service by default
// conf.AppID will be overwrite by a fixed value DiscoveryAppId
// therefore is no need to set
func New(conf *liverpc.ClientConfig) *Client {
if conf == nil {
conf = &liverpc.ClientConfig{}
}
conf.AppID = DiscoveryAppId
var realCli = liverpc.NewClient(conf)
cli := &Client{cli: realCli}
cli.clientInit(realCli)
return cli
}
func (cli *Client) GetRawCli() *liverpc.Client {
return cli.cli
}
func (cli *Client) clientInit(realCli *liverpc.Client) {
cli.V1App = v1.NewAppRpcClient(realCli)
cli.V1BaseInfo = v1.NewBaseInfoRpcClient(realCli)
cli.V1Feed = v1.NewFeedRpcClient(realCli)
cli.V2App = v2.NewAppRpcClient(realCli)
}