feat 包命名规范
This commit is contained in:
24
net/grpc/grpcclient/client_user.go
Normal file
24
net/grpc/grpcclient/client_user.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package grpcclient
|
||||
|
||||
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/rspb"
|
||||
)
|
||||
|
||||
func UserNewClient(sid ...int64) (rspb.UserClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverUser, sid...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rspb.NewUserClient(c), nil
|
||||
}
|
||||
|
||||
func UserNewClientLB() (rspb.UserClient, error) {
|
||||
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameUser)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rspb.NewUserClient(c), nil
|
||||
}
|
||||
Reference in New Issue
Block a user