feat grpc客户端整理
This commit is contained in:
24
net/grpc/grpc_client/client_qgdzs.go
Normal file
24
net/grpc/grpc_client/client_qgdzs.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package grpc_client
|
||||
|
||||
import (
|
||||
"git.hlsq.asia/mmorpg/service-common/discover"
|
||||
"git.hlsq.asia/mmorpg/service-common/discover/common"
|
||||
"git.hlsq.asia/mmorpg/service-common/net/grpc/resolver"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
||||
)
|
||||
|
||||
func QgdzsNewClient(sid ...string) (grpc_pb.QgdzsClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverQgdzs, sid...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return grpc_pb.NewQgdzsClient(c), nil
|
||||
}
|
||||
|
||||
func QgdzsNewClientLB() (grpc_pb.QgdzsClient, error) {
|
||||
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameQgdzs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return grpc_pb.NewQgdzsClient(c), nil
|
||||
}
|
||||
Reference in New Issue
Block a user