Refactor: Remove deprecated gRPC service files and implement new API structure

- Deleted old gRPC service definitions in `game_grpc.pb.go` and `public.go`.
- Added new API server implementations for objectstory, player, and shop services.
- Introduced configuration files for new APIs in `etc/*.yaml`.
- Created main entry points for each service in `objectstory.go`, `player.go`, and `shop.go`.
- Removed unused user update handler and user API files.
- Added utility functions for context management and HTTP header parsing.
- Introduced PostgreSQL backup configuration in `backup/postgreSql.yaml`.
This commit is contained in:
wwweww
2026-02-28 18:35:56 +08:00
parent d2f33b4b96
commit 19cc7a778c
349 changed files with 42548 additions and 1453 deletions
+56 -45
View File
@@ -556,16 +556,16 @@ func (x *GetGamesByIdResp) GetGames() *Games {
type SearchGamesReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page
Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit
Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` //name
Icon string `protobuf:"bytes,5,opt,name=icon,proto3" json:"icon,omitempty"` //icon
Category string `protobuf:"bytes,6,opt,name=category,proto3" json:"category,omitempty"` //category
SortOrder int64 `protobuf:"varint,7,opt,name=sortOrder,proto3" json:"sortOrder,omitempty"` //sortOrder
IsActive bool `protobuf:"varint,8,opt,name=isActive,proto3" json:"isActive,omitempty"` //isActive
CreatedAt int64 `protobuf:"varint,9,opt,name=createdAt,proto3" json:"createdAt,omitempty"` //createdAt
UpdatedAt int64 `protobuf:"varint,10,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` //updatedAt
Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page
Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit
Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id
Name *string `protobuf:"bytes,4,opt,name=name,proto3,oneof" json:"name,omitempty"` //name
Icon *string `protobuf:"bytes,5,opt,name=icon,proto3,oneof" json:"icon,omitempty"` //icon
Category *string `protobuf:"bytes,6,opt,name=category,proto3,oneof" json:"category,omitempty"` //category
SortOrder *int64 `protobuf:"varint,7,opt,name=sortOrder,proto3,oneof" json:"sortOrder,omitempty"` //sortOrder
IsActive *bool `protobuf:"varint,8,opt,name=isActive,proto3,oneof" json:"isActive,omitempty"` //isActive
CreatedAt *int64 `protobuf:"varint,9,opt,name=createdAt,proto3,oneof" json:"createdAt,omitempty"` //createdAt
UpdatedAt *int64 `protobuf:"varint,10,opt,name=updatedAt,proto3,oneof" json:"updatedAt,omitempty"` //updatedAt
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -622,50 +622,50 @@ func (x *SearchGamesReq) GetId() int64 {
}
func (x *SearchGamesReq) GetName() string {
if x != nil {
return x.Name
if x != nil && x.Name != nil {
return *x.Name
}
return ""
}
func (x *SearchGamesReq) GetIcon() string {
if x != nil {
return x.Icon
if x != nil && x.Icon != nil {
return *x.Icon
}
return ""
}
func (x *SearchGamesReq) GetCategory() string {
if x != nil {
return x.Category
if x != nil && x.Category != nil {
return *x.Category
}
return ""
}
func (x *SearchGamesReq) GetSortOrder() int64 {
if x != nil {
return x.SortOrder
if x != nil && x.SortOrder != nil {
return *x.SortOrder
}
return 0
}
func (x *SearchGamesReq) GetIsActive() bool {
if x != nil {
return x.IsActive
if x != nil && x.IsActive != nil {
return *x.IsActive
}
return false
}
func (x *SearchGamesReq) GetCreatedAt() int64 {
if x != nil {
return x.CreatedAt
if x != nil && x.CreatedAt != nil {
return *x.CreatedAt
}
return 0
}
func (x *SearchGamesReq) GetUpdatedAt() int64 {
if x != nil {
return x.UpdatedAt
if x != nil && x.UpdatedAt != nil {
return *x.UpdatedAt
}
return 0
}
@@ -754,22 +754,32 @@ const file_game_proto_rawDesc = "" +
"\x0fGetGamesByIdReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\"3\n" +
"\x10GetGamesByIdResp\x12\x1f\n" +
"\x05games\x18\x01 \x01(\v2\t.pb.GamesR\x05games\"\x84\x02\n" +
"\x05games\x18\x01 \x01(\v2\t.pb.GamesR\x05games\"\xfd\x02\n" +
"\x0eSearchGamesReq\x12\x12\n" +
"\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" +
"\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" +
"\x02id\x18\x03 \x01(\x03R\x02id\x12\x12\n" +
"\x04name\x18\x04 \x01(\tR\x04name\x12\x12\n" +
"\x04icon\x18\x05 \x01(\tR\x04icon\x12\x1a\n" +
"\bcategory\x18\x06 \x01(\tR\bcategory\x12\x1c\n" +
"\tsortOrder\x18\a \x01(\x03R\tsortOrder\x12\x1a\n" +
"\bisActive\x18\b \x01(\bR\bisActive\x12\x1c\n" +
"\tcreatedAt\x18\t \x01(\x03R\tcreatedAt\x12\x1c\n" +
"\x02id\x18\x03 \x01(\x03R\x02id\x12\x17\n" +
"\x04name\x18\x04 \x01(\tH\x00R\x04name\x88\x01\x01\x12\x17\n" +
"\x04icon\x18\x05 \x01(\tH\x01R\x04icon\x88\x01\x01\x12\x1f\n" +
"\bcategory\x18\x06 \x01(\tH\x02R\bcategory\x88\x01\x01\x12!\n" +
"\tsortOrder\x18\a \x01(\x03H\x03R\tsortOrder\x88\x01\x01\x12\x1f\n" +
"\bisActive\x18\b \x01(\bH\x04R\bisActive\x88\x01\x01\x12!\n" +
"\tcreatedAt\x18\t \x01(\x03H\x05R\tcreatedAt\x88\x01\x01\x12!\n" +
"\tupdatedAt\x18\n" +
" \x01(\x03R\tupdatedAt\"2\n" +
" \x01(\x03H\x06R\tupdatedAt\x88\x01\x01B\a\n" +
"\x05_nameB\a\n" +
"\x05_iconB\v\n" +
"\t_categoryB\f\n" +
"\n" +
"_sortOrderB\v\n" +
"\t_isActiveB\f\n" +
"\n" +
"_createdAtB\f\n" +
"\n" +
"_updatedAt\"2\n" +
"\x0fSearchGamesResp\x12\x1f\n" +
"\x05games\x18\x01 \x03(\v2\t.pb.GamesR\x05games2\x91\x02\n" +
"\x06public\x12-\n" +
"\x05games\x18\x01 \x03(\v2\t.pb.GamesR\x05games2\x96\x02\n" +
"\vGameService\x12-\n" +
"\bAddGames\x12\x0f.pb.AddGamesReq\x1a\x10.pb.AddGamesResp\x126\n" +
"\vUpdateGames\x12\x12.pb.UpdateGamesReq\x1a\x13.pb.UpdateGamesResp\x12-\n" +
"\bDelGames\x12\x0f.pb.DelGamesReq\x1a\x10.pb.DelGamesResp\x129\n" +
@@ -805,16 +815,16 @@ var file_game_proto_goTypes = []any{
var file_game_proto_depIdxs = []int32{
0, // 0: pb.GetGamesByIdResp.games:type_name -> pb.Games
0, // 1: pb.SearchGamesResp.games:type_name -> pb.Games
1, // 2: pb.public.AddGames:input_type -> pb.AddGamesReq
3, // 3: pb.public.UpdateGames:input_type -> pb.UpdateGamesReq
5, // 4: pb.public.DelGames:input_type -> pb.DelGamesReq
7, // 5: pb.public.GetGamesById:input_type -> pb.GetGamesByIdReq
9, // 6: pb.public.SearchGames:input_type -> pb.SearchGamesReq
2, // 7: pb.public.AddGames:output_type -> pb.AddGamesResp
4, // 8: pb.public.UpdateGames:output_type -> pb.UpdateGamesResp
6, // 9: pb.public.DelGames:output_type -> pb.DelGamesResp
8, // 10: pb.public.GetGamesById:output_type -> pb.GetGamesByIdResp
10, // 11: pb.public.SearchGames:output_type -> pb.SearchGamesResp
1, // 2: pb.GameService.AddGames:input_type -> pb.AddGamesReq
3, // 3: pb.GameService.UpdateGames:input_type -> pb.UpdateGamesReq
5, // 4: pb.GameService.DelGames:input_type -> pb.DelGamesReq
7, // 5: pb.GameService.GetGamesById:input_type -> pb.GetGamesByIdReq
9, // 6: pb.GameService.SearchGames:input_type -> pb.SearchGamesReq
2, // 7: pb.GameService.AddGames:output_type -> pb.AddGamesResp
4, // 8: pb.GameService.UpdateGames:output_type -> pb.UpdateGamesResp
6, // 9: pb.GameService.DelGames:output_type -> pb.DelGamesResp
8, // 10: pb.GameService.GetGamesById:output_type -> pb.GetGamesByIdResp
10, // 11: pb.GameService.SearchGames:output_type -> pb.SearchGamesResp
7, // [7:12] is the sub-list for method output_type
2, // [2:7] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
@@ -827,6 +837,7 @@ func file_game_proto_init() {
if File_game_proto != nil {
return
}
file_game_proto_msgTypes[9].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
+69 -69
View File
@@ -19,17 +19,17 @@ import (
const _ = grpc.SupportPackageIsVersion9
const (
Public_AddGames_FullMethodName = "/pb.public/AddGames"
Public_UpdateGames_FullMethodName = "/pb.public/UpdateGames"
Public_DelGames_FullMethodName = "/pb.public/DelGames"
Public_GetGamesById_FullMethodName = "/pb.public/GetGamesById"
Public_SearchGames_FullMethodName = "/pb.public/SearchGames"
GameService_AddGames_FullMethodName = "/pb.GameService/AddGames"
GameService_UpdateGames_FullMethodName = "/pb.GameService/UpdateGames"
GameService_DelGames_FullMethodName = "/pb.GameService/DelGames"
GameService_GetGamesById_FullMethodName = "/pb.GameService/GetGamesById"
GameService_SearchGames_FullMethodName = "/pb.GameService/SearchGames"
)
// PublicClient is the client API for Public service.
// GameServiceClient is the client API for GameService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PublicClient interface {
type GameServiceClient interface {
// -----------------------games-----------------------
AddGames(ctx context.Context, in *AddGamesReq, opts ...grpc.CallOption) (*AddGamesResp, error)
UpdateGames(ctx context.Context, in *UpdateGamesReq, opts ...grpc.CallOption) (*UpdateGamesResp, error)
@@ -38,236 +38,236 @@ type PublicClient interface {
SearchGames(ctx context.Context, in *SearchGamesReq, opts ...grpc.CallOption) (*SearchGamesResp, error)
}
type publicClient struct {
type gameServiceClient struct {
cc grpc.ClientConnInterface
}
func NewPublicClient(cc grpc.ClientConnInterface) PublicClient {
return &publicClient{cc}
func NewGameServiceClient(cc grpc.ClientConnInterface) GameServiceClient {
return &gameServiceClient{cc}
}
func (c *publicClient) AddGames(ctx context.Context, in *AddGamesReq, opts ...grpc.CallOption) (*AddGamesResp, error) {
func (c *gameServiceClient) AddGames(ctx context.Context, in *AddGamesReq, opts ...grpc.CallOption) (*AddGamesResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddGamesResp)
err := c.cc.Invoke(ctx, Public_AddGames_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, GameService_AddGames_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *publicClient) UpdateGames(ctx context.Context, in *UpdateGamesReq, opts ...grpc.CallOption) (*UpdateGamesResp, error) {
func (c *gameServiceClient) UpdateGames(ctx context.Context, in *UpdateGamesReq, opts ...grpc.CallOption) (*UpdateGamesResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateGamesResp)
err := c.cc.Invoke(ctx, Public_UpdateGames_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, GameService_UpdateGames_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *publicClient) DelGames(ctx context.Context, in *DelGamesReq, opts ...grpc.CallOption) (*DelGamesResp, error) {
func (c *gameServiceClient) DelGames(ctx context.Context, in *DelGamesReq, opts ...grpc.CallOption) (*DelGamesResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DelGamesResp)
err := c.cc.Invoke(ctx, Public_DelGames_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, GameService_DelGames_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *publicClient) GetGamesById(ctx context.Context, in *GetGamesByIdReq, opts ...grpc.CallOption) (*GetGamesByIdResp, error) {
func (c *gameServiceClient) GetGamesById(ctx context.Context, in *GetGamesByIdReq, opts ...grpc.CallOption) (*GetGamesByIdResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetGamesByIdResp)
err := c.cc.Invoke(ctx, Public_GetGamesById_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, GameService_GetGamesById_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *publicClient) SearchGames(ctx context.Context, in *SearchGamesReq, opts ...grpc.CallOption) (*SearchGamesResp, error) {
func (c *gameServiceClient) SearchGames(ctx context.Context, in *SearchGamesReq, opts ...grpc.CallOption) (*SearchGamesResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SearchGamesResp)
err := c.cc.Invoke(ctx, Public_SearchGames_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, GameService_SearchGames_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// PublicServer is the server API for Public service.
// All implementations must embed UnimplementedPublicServer
// GameServiceServer is the server API for GameService service.
// All implementations must embed UnimplementedGameServiceServer
// for forward compatibility.
type PublicServer interface {
type GameServiceServer interface {
// -----------------------games-----------------------
AddGames(context.Context, *AddGamesReq) (*AddGamesResp, error)
UpdateGames(context.Context, *UpdateGamesReq) (*UpdateGamesResp, error)
DelGames(context.Context, *DelGamesReq) (*DelGamesResp, error)
GetGamesById(context.Context, *GetGamesByIdReq) (*GetGamesByIdResp, error)
SearchGames(context.Context, *SearchGamesReq) (*SearchGamesResp, error)
mustEmbedUnimplementedPublicServer()
mustEmbedUnimplementedGameServiceServer()
}
// UnimplementedPublicServer must be embedded to have
// UnimplementedGameServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedPublicServer struct{}
type UnimplementedGameServiceServer struct{}
func (UnimplementedPublicServer) AddGames(context.Context, *AddGamesReq) (*AddGamesResp, error) {
func (UnimplementedGameServiceServer) AddGames(context.Context, *AddGamesReq) (*AddGamesResp, error) {
return nil, status.Error(codes.Unimplemented, "method AddGames not implemented")
}
func (UnimplementedPublicServer) UpdateGames(context.Context, *UpdateGamesReq) (*UpdateGamesResp, error) {
func (UnimplementedGameServiceServer) UpdateGames(context.Context, *UpdateGamesReq) (*UpdateGamesResp, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateGames not implemented")
}
func (UnimplementedPublicServer) DelGames(context.Context, *DelGamesReq) (*DelGamesResp, error) {
func (UnimplementedGameServiceServer) DelGames(context.Context, *DelGamesReq) (*DelGamesResp, error) {
return nil, status.Error(codes.Unimplemented, "method DelGames not implemented")
}
func (UnimplementedPublicServer) GetGamesById(context.Context, *GetGamesByIdReq) (*GetGamesByIdResp, error) {
func (UnimplementedGameServiceServer) GetGamesById(context.Context, *GetGamesByIdReq) (*GetGamesByIdResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetGamesById not implemented")
}
func (UnimplementedPublicServer) SearchGames(context.Context, *SearchGamesReq) (*SearchGamesResp, error) {
func (UnimplementedGameServiceServer) SearchGames(context.Context, *SearchGamesReq) (*SearchGamesResp, error) {
return nil, status.Error(codes.Unimplemented, "method SearchGames not implemented")
}
func (UnimplementedPublicServer) mustEmbedUnimplementedPublicServer() {}
func (UnimplementedPublicServer) testEmbeddedByValue() {}
func (UnimplementedGameServiceServer) mustEmbedUnimplementedGameServiceServer() {}
func (UnimplementedGameServiceServer) testEmbeddedByValue() {}
// UnsafePublicServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PublicServer will
// UnsafeGameServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to GameServiceServer will
// result in compilation errors.
type UnsafePublicServer interface {
mustEmbedUnimplementedPublicServer()
type UnsafeGameServiceServer interface {
mustEmbedUnimplementedGameServiceServer()
}
func RegisterPublicServer(s grpc.ServiceRegistrar, srv PublicServer) {
// If the following call panics, it indicates UnimplementedPublicServer was
func RegisterGameServiceServer(s grpc.ServiceRegistrar, srv GameServiceServer) {
// If the following call panics, it indicates UnimplementedGameServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Public_ServiceDesc, srv)
s.RegisterService(&GameService_ServiceDesc, srv)
}
func _Public_AddGames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _GameService_AddGames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddGamesReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PublicServer).AddGames(ctx, in)
return srv.(GameServiceServer).AddGames(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Public_AddGames_FullMethodName,
FullMethod: GameService_AddGames_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PublicServer).AddGames(ctx, req.(*AddGamesReq))
return srv.(GameServiceServer).AddGames(ctx, req.(*AddGamesReq))
}
return interceptor(ctx, in, info, handler)
}
func _Public_UpdateGames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _GameService_UpdateGames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateGamesReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PublicServer).UpdateGames(ctx, in)
return srv.(GameServiceServer).UpdateGames(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Public_UpdateGames_FullMethodName,
FullMethod: GameService_UpdateGames_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PublicServer).UpdateGames(ctx, req.(*UpdateGamesReq))
return srv.(GameServiceServer).UpdateGames(ctx, req.(*UpdateGamesReq))
}
return interceptor(ctx, in, info, handler)
}
func _Public_DelGames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _GameService_DelGames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DelGamesReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PublicServer).DelGames(ctx, in)
return srv.(GameServiceServer).DelGames(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Public_DelGames_FullMethodName,
FullMethod: GameService_DelGames_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PublicServer).DelGames(ctx, req.(*DelGamesReq))
return srv.(GameServiceServer).DelGames(ctx, req.(*DelGamesReq))
}
return interceptor(ctx, in, info, handler)
}
func _Public_GetGamesById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _GameService_GetGamesById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetGamesByIdReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PublicServer).GetGamesById(ctx, in)
return srv.(GameServiceServer).GetGamesById(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Public_GetGamesById_FullMethodName,
FullMethod: GameService_GetGamesById_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PublicServer).GetGamesById(ctx, req.(*GetGamesByIdReq))
return srv.(GameServiceServer).GetGamesById(ctx, req.(*GetGamesByIdReq))
}
return interceptor(ctx, in, info, handler)
}
func _Public_SearchGames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _GameService_SearchGames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchGamesReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PublicServer).SearchGames(ctx, in)
return srv.(GameServiceServer).SearchGames(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Public_SearchGames_FullMethodName,
FullMethod: GameService_SearchGames_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PublicServer).SearchGames(ctx, req.(*SearchGamesReq))
return srv.(GameServiceServer).SearchGames(ctx, req.(*SearchGamesReq))
}
return interceptor(ctx, in, info, handler)
}
// Public_ServiceDesc is the grpc.ServiceDesc for Public service.
// GameService_ServiceDesc is the grpc.ServiceDesc for GameService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Public_ServiceDesc = grpc.ServiceDesc{
ServiceName: "pb.public",
HandlerType: (*PublicServer)(nil),
var GameService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "pb.GameService",
HandlerType: (*GameServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "AddGames",
Handler: _Public_AddGames_Handler,
Handler: _GameService_AddGames_Handler,
},
{
MethodName: "UpdateGames",
Handler: _Public_UpdateGames_Handler,
Handler: _GameService_UpdateGames_Handler,
},
{
MethodName: "DelGames",
Handler: _Public_DelGames_Handler,
Handler: _GameService_DelGames_Handler,
},
{
MethodName: "GetGamesById",
Handler: _Public_GetGamesById_Handler,
Handler: _GameService_GetGamesById_Handler,
},
{
MethodName: "SearchGames",
Handler: _Public_SearchGames_Handler,
Handler: _GameService_SearchGames_Handler,
},
},
Streams: []grpc.StreamDesc{},