feat 包命名规范
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
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/proto/rs/grpc_pb"
|
||||
)
|
||||
|
||||
func GatewayNewClient(sid ...int64) (grpc_pb.GatewayClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverGateway, sid...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return grpc_pb.NewGatewayClient(c), nil
|
||||
}
|
||||
|
||||
func GatewayNewBroadcastClient() map[int64]grpc_pb.GatewayClient {
|
||||
clientM := make(map[int64]grpc_pb.GatewayClient)
|
||||
connM := discover.FindServerAll(common.KeyDiscoverGateway)
|
||||
for sid, conn := range connM {
|
||||
clientM[sid] = grpc_pb.NewGatewayClient(conn)
|
||||
}
|
||||
return clientM
|
||||
}
|
||||
24
net/grpc/grpcclient/client_gateway.go
Normal file
24
net/grpc/grpcclient/client_gateway.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/proto/rs/rspb"
|
||||
)
|
||||
|
||||
func GatewayNewClient(sid ...int64) (rspb.GatewayClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverGateway, sid...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rspb.NewGatewayClient(c), nil
|
||||
}
|
||||
|
||||
func GatewayNewBroadcastClient() map[int64]rspb.GatewayClient {
|
||||
clientM := make(map[int64]rspb.GatewayClient)
|
||||
connM := discover.FindServerAll(common.KeyDiscoverGateway)
|
||||
for sid, conn := range connM {
|
||||
clientM[sid] = rspb.NewGatewayClient(conn)
|
||||
}
|
||||
return clientM
|
||||
}
|
||||
@@ -1,24 +1,24 @@
|
||||
package grpc_client
|
||||
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/grpc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/rspb"
|
||||
)
|
||||
|
||||
func QgdzsNewClient(sid ...int64) (grpc_pb.QgdzsClient, error) {
|
||||
func QgdzsNewClient(sid ...int64) (rspb.QgdzsClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverQgdzs, sid...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return grpc_pb.NewQgdzsClient(c), nil
|
||||
return rspb.NewQgdzsClient(c), nil
|
||||
}
|
||||
|
||||
func QgdzsNewClientLB() (grpc_pb.QgdzsClient, error) {
|
||||
func QgdzsNewClientLB() (rspb.QgdzsClient, error) {
|
||||
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameQgdzs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return grpc_pb.NewQgdzsClient(c), nil
|
||||
return rspb.NewQgdzsClient(c), nil
|
||||
}
|
||||
@@ -1,33 +1,33 @@
|
||||
package grpc_client
|
||||
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/grpc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/rspb"
|
||||
)
|
||||
|
||||
func SceneNewClient(sid ...int64) (grpc_pb.SceneClient, error) {
|
||||
func SceneNewClient(sid ...int64) (rspb.SceneClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverScene, sid...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return grpc_pb.NewSceneClient(c), nil
|
||||
return rspb.NewSceneClient(c), nil
|
||||
}
|
||||
|
||||
func SceneNewClientLB() (grpc_pb.SceneClient, error) {
|
||||
func SceneNewClientLB() (rspb.SceneClient, error) {
|
||||
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameScene)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return grpc_pb.NewSceneClient(c), nil
|
||||
return rspb.NewSceneClient(c), nil
|
||||
}
|
||||
|
||||
func SceneNewBroadcastClient() map[int64]grpc_pb.SceneClient {
|
||||
clientM := make(map[int64]grpc_pb.SceneClient)
|
||||
func SceneNewBroadcastClient() map[int64]rspb.SceneClient {
|
||||
clientM := make(map[int64]rspb.SceneClient)
|
||||
connM := discover.FindServerAll(common.KeyDiscoverScene)
|
||||
for sid, conn := range connM {
|
||||
clientM[sid] = grpc_pb.NewSceneClient(conn)
|
||||
clientM[sid] = rspb.NewSceneClient(conn)
|
||||
}
|
||||
return clientM
|
||||
}
|
||||
@@ -1,24 +1,24 @@
|
||||
package grpc_client
|
||||
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/grpc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/rspb"
|
||||
)
|
||||
|
||||
func UserNewClient(sid ...int64) (grpc_pb.UserClient, error) {
|
||||
func UserNewClient(sid ...int64) (rspb.UserClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverUser, sid...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return grpc_pb.NewUserClient(c), nil
|
||||
return rspb.NewUserClient(c), nil
|
||||
}
|
||||
|
||||
func UserNewClientLB() (grpc_pb.UserClient, error) {
|
||||
func UserNewClientLB() (rspb.UserClient, error) {
|
||||
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameUser)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return grpc_pb.NewUserClient(c), nil
|
||||
return rspb.NewUserClient(c), nil
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package grpc_client
|
||||
package grpcclient
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,4 +1,4 @@
|
||||
package grpc_client
|
||||
package grpcclient
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,4 +1,4 @@
|
||||
package grpc_conn
|
||||
package grpcconn
|
||||
|
||||
import (
|
||||
"git.hlsq.asia/mmorpg/service-common/log"
|
||||
@@ -1,4 +1,4 @@
|
||||
package grpc_conn
|
||||
package grpcconn
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
Reference in New Issue
Block a user