Eliminate proto.Unmarshal in the generated code
This commit is contained in:
@ -539,9 +539,9 @@ func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) {
|
|||||||
s.RegisterService(&_TestService_serviceDesc, srv)
|
s.RegisterService(&_TestService_serviceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) {
|
func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
|
||||||
in := new(Empty)
|
in := new(Empty)
|
||||||
if err := proto.Unmarshal(buf, in); err != nil {
|
if err := codec.Unmarshal(buf, in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
out, err := srv.(TestServiceServer).EmptyCall(ctx, in)
|
out, err := srv.(TestServiceServer).EmptyCall(ctx, in)
|
||||||
@ -551,9 +551,9 @@ func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, buf []
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) {
|
func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
|
||||||
in := new(SimpleRequest)
|
in := new(SimpleRequest)
|
||||||
if err := proto.Unmarshal(buf, in); err != nil {
|
if err := codec.Unmarshal(buf, in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
out, err := srv.(TestServiceServer).UnaryCall(ctx, in)
|
out, err := srv.(TestServiceServer).UnaryCall(ctx, in)
|
||||||
|
@ -310,9 +310,9 @@ func RegisterRouteGuideServer(s *grpc.Server, srv RouteGuideServer) {
|
|||||||
s.RegisterService(&_RouteGuide_serviceDesc, srv)
|
s.RegisterService(&_RouteGuide_serviceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _RouteGuide_GetFeature_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) {
|
func _RouteGuide_GetFeature_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
|
||||||
in := new(Point)
|
in := new(Point)
|
||||||
if err := proto1.Unmarshal(buf, in); err != nil {
|
if err := codec.Unmarshal(buf, in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
out, err := srv.(RouteGuideServer).GetFeature(ctx, in)
|
out, err := srv.(RouteGuideServer).GetFeature(ctx, in)
|
||||||
|
@ -539,9 +539,9 @@ func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) {
|
|||||||
s.RegisterService(&_TestService_serviceDesc, srv)
|
s.RegisterService(&_TestService_serviceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) {
|
func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
|
||||||
in := new(Empty)
|
in := new(Empty)
|
||||||
if err := proto.Unmarshal(buf, in); err != nil {
|
if err := codec.Unmarshal(buf, in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
out, err := srv.(TestServiceServer).EmptyCall(ctx, in)
|
out, err := srv.(TestServiceServer).EmptyCall(ctx, in)
|
||||||
@ -551,9 +551,9 @@ func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, buf []
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) {
|
func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
|
||||||
in := new(SimpleRequest)
|
in := new(SimpleRequest)
|
||||||
if err := proto.Unmarshal(buf, in); err != nil {
|
if err := codec.Unmarshal(buf, in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
out, err := srv.(TestServiceServer).UnaryCall(ctx, in)
|
out, err := srv.(TestServiceServer).UnaryCall(ctx, in)
|
||||||
|
@ -49,7 +49,7 @@ import (
|
|||||||
"google.golang.org/grpc/transport"
|
"google.golang.org/grpc/transport"
|
||||||
)
|
)
|
||||||
|
|
||||||
type methodHandler func(srv interface{}, ctx context.Context, buf []byte) (interface{}, error)
|
type methodHandler func(srv interface{}, ctx context.Context, codec Codec, buf []byte) (interface{}, error)
|
||||||
|
|
||||||
// MethodDesc represents an RPC service's method specification.
|
// MethodDesc represents an RPC service's method specification.
|
||||||
type MethodDesc struct {
|
type MethodDesc struct {
|
||||||
@ -253,7 +253,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||||||
case compressionNone:
|
case compressionNone:
|
||||||
statusCode := codes.OK
|
statusCode := codes.OK
|
||||||
statusDesc := ""
|
statusDesc := ""
|
||||||
reply, appErr := md.Handler(srv.server, stream.Context(), req)
|
reply, appErr := md.Handler(srv.server, stream.Context(), s.opts.codec, req)
|
||||||
if appErr != nil {
|
if appErr != nil {
|
||||||
if err, ok := appErr.(rpcError); ok {
|
if err, ok := appErr.(rpcError); ok {
|
||||||
statusCode = err.code
|
statusCode = err.code
|
||||||
|
@ -539,9 +539,9 @@ func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) {
|
|||||||
s.RegisterService(&_TestService_serviceDesc, srv)
|
s.RegisterService(&_TestService_serviceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) {
|
func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
|
||||||
in := new(Empty)
|
in := new(Empty)
|
||||||
if err := proto.Unmarshal(buf, in); err != nil {
|
if err := codec.Unmarshal(buf, in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
out, err := srv.(TestServiceServer).EmptyCall(ctx, in)
|
out, err := srv.(TestServiceServer).EmptyCall(ctx, in)
|
||||||
@ -551,9 +551,9 @@ func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, buf []
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, buf []byte) (interface{}, error) {
|
func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
|
||||||
in := new(SimpleRequest)
|
in := new(SimpleRequest)
|
||||||
if err := proto.Unmarshal(buf, in); err != nil {
|
if err := codec.Unmarshal(buf, in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
out, err := srv.(TestServiceServer).UnaryCall(ctx, in)
|
out, err := srv.(TestServiceServer).UnaryCall(ctx, in)
|
||||||
|
Reference in New Issue
Block a user