25 lines
686 B
Go
25 lines
686 B
Go
package grpcclient
|
|
|
|
import (
|
|
"git.hlsq.asia/alex/proto/proto/rs/rspb"
|
|
"git.hlsq.asia/alex/service-common/discover"
|
|
"git.hlsq.asia/alex/service-common/discover/common"
|
|
"git.hlsq.asia/alex/service-common/net/grpc/resolver"
|
|
)
|
|
|
|
func ThirdPartyNewClient(sid ...int64) (rspb.ThirdPartyClient, error) {
|
|
c, err := discover.FindServer(common.KeyDiscoverThirdParty, sid...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rspb.NewThirdPartyClient(c), nil
|
|
}
|
|
|
|
func ThirdPartyNewClientLB() (rspb.ThirdPartyClient, error) {
|
|
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameThirdParty)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rspb.NewThirdPartyClient(c), nil
|
|
}
|