feat 初始化
This commit is contained in:
@@ -4,10 +4,18 @@ 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"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func GatewayNewClient(sid ...int64) (rspb.GatewayClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverGateway, sid...)
|
||||
var c *grpc.ClientConn
|
||||
var err error
|
||||
if len(sid) == 0 {
|
||||
c, err = resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameGateway)
|
||||
} else {
|
||||
c, err = discover.FindServer(common.KeyDiscoverGateway, sid...)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user