feat 包命名规范

This commit is contained in:
2026-02-11 14:49:44 +08:00
parent fc9b32b115
commit 14cb2f3270
22 changed files with 137 additions and 135 deletions

View File

@@ -0,0 +1,41 @@
package grpcserver
import (
"git.hlsq.asia/mmorpg/service-common/config"
"git.hlsq.asia/mmorpg/service-common/discover/common"
"git.hlsq.asia/mmorpg/service-common/net/grpc/service"
"git.hlsq.asia/mmorpg/service-common/proto/rs/rspb"
"git.hlsq.asia/mmorpg/service-gateway/internal/global"
"google.golang.org/grpc"
)
type Server struct {
rspb.UnimplementedGatewayServer
service.Base
}
func NewServer(cfg *config.GrpcConfig) *Server {
s := &Server{
Base: service.Base{
Target: common.KeyDiscoverGateway,
ServiceName: common.KeyDiscoverServiceNameGateway,
Cfg: cfg,
},
}
s.Base.OnCustomGrpcServerOption = s.OnCustomGrpcServerOption
s.Base.OnInit = s.OnInit
s.Base.OnClose = s.OnClose
return s
}
func (s *Server) OnCustomGrpcServerOption() []grpc.ServerOption {
return nil
}
func (s *Server) OnInit(serve *grpc.Server) {
global.GatewaySID = s.SID
rspb.RegisterGatewayServer(serve, s)
}
func (s *Server) OnClose() {
}