feat 包命名规范

This commit is contained in:
2026-02-11 14:49:46 +08:00
parent 1a42e055ae
commit 77cc02fc95
12 changed files with 65 additions and 92 deletions

View File

@@ -0,0 +1,43 @@
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-qgdzs/internal/dao/query"
"git.hlsq.asia/mmorpg/service-qgdzs/internal/dao/repository"
"google.golang.org/grpc"
)
type Server struct {
rspb.UnimplementedQgdzsServer
service.Base
query *query.Query
}
func NewServer(cfg *config.GrpcConfig) *Server {
s := &Server{
Base: service.Base{
Target: common.KeyDiscoverQgdzs,
ServiceName: common.KeyDiscoverServiceNameQgdzs,
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) {
rspb.RegisterQgdzsServer(serve, s)
s.query = repository.Query()
}
func (s *Server) OnClose() {
}