feat 包命名规范

This commit is contained in:
2026-02-11 14:49:53 +08:00
parent 79c780d4b8
commit d7a4973642
5 changed files with 19 additions and 19 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-user/internal/dao/query"
"git.hlsq.asia/mmorpg/service-user/internal/dao/repository"
"google.golang.org/grpc"
)
type Server struct {
rspb.UnimplementedUserServer
service.Base
query *query.Query
}
func NewServer(cfg *config.GrpcConfig) *Server {
s := &Server{
Base: service.Base{
Target: common.KeyDiscoverUser,
ServiceName: common.KeyDiscoverServiceNameUser,
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.RegisterUserServer(serve, s)
s.query = repository.Query()
}
func (s *Server) OnClose() {
}