本文整理匯總了Golang中github.com/coreos/mantle/Godeps/_workspace/src/google/golang.org/grpc.Codec類的典型用法代碼示例。如果您正苦於以下問題:Golang Codec類的具體用法?Golang Codec怎麽用?Golang Codec使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Codec類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: _RouteGuide_GetFeature_Handler
func _RouteGuide_GetFeature_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
in := new(Point)
if err := codec.Unmarshal(buf, in); err != nil {
return nil, err
}
out, err := srv.(RouteGuideServer).GetFeature(ctx, in)
if err != nil {
return nil, err
}
return out, nil
}
示例2: _Greeter_SayHello_Handler
func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
in := new(HelloRequest)
if err := codec.Unmarshal(buf, in); err != nil {
return nil, err
}
out, err := srv.(GreeterServer).SayHello(ctx, in)
if err != nil {
return nil, err
}
return out, nil
}
示例3: _TestService_UnaryCall_Handler
func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
in := new(SimpleRequest)
if err := codec.Unmarshal(buf, in); err != nil {
return nil, err
}
out, err := srv.(TestServiceServer).UnaryCall(ctx, in)
if err != nil {
return nil, err
}
return out, nil
}
示例4: _HealthCheck_Check_Handler
func _HealthCheck_Check_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
in := new(HealthCheckRequest)
if err := codec.Unmarshal(buf, in); err != nil {
return nil, err
}
out, err := srv.(HealthCheckServer).Check(ctx, in)
if err != nil {
return nil, err
}
return out, nil
}