MCPcopy
hub / github.com/grpc/grpc-go / V1AlphaToV1Request

Function V1AlphaToV1Request

reflection/internal/internal.go:305–338  ·  view source on GitHub ↗

V1AlphaToV1Request converts a v1alpha ServerReflectionRequest to a v1.

(v1alpha *v1alphareflectionpb.ServerReflectionRequest)

Source from the content-addressed store, hash-verified

303
304// V1AlphaToV1Request converts a v1alpha ServerReflectionRequest to a v1.
305func V1AlphaToV1Request(v1alpha *v1alphareflectionpb.ServerReflectionRequest) *v1reflectionpb.ServerReflectionRequest {
306 var v1 v1reflectionpb.ServerReflectionRequest
307 v1.Host = v1alpha.Host
308 switch mr := v1alpha.MessageRequest.(type) {
309 case *v1alphareflectionpb.ServerReflectionRequest_FileByFilename:
310 v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_FileByFilename{
311 FileByFilename: mr.FileByFilename,
312 }
313 case *v1alphareflectionpb.ServerReflectionRequest_FileContainingSymbol:
314 v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_FileContainingSymbol{
315 FileContainingSymbol: mr.FileContainingSymbol,
316 }
317 case *v1alphareflectionpb.ServerReflectionRequest_FileContainingExtension:
318 if mr.FileContainingExtension != nil {
319 v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_FileContainingExtension{
320 FileContainingExtension: &v1reflectionpb.ExtensionRequest{
321 ContainingType: mr.FileContainingExtension.GetContainingType(),
322 ExtensionNumber: mr.FileContainingExtension.GetExtensionNumber(),
323 },
324 }
325 }
326 case *v1alphareflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType:
327 v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType{
328 AllExtensionNumbersOfType: mr.AllExtensionNumbersOfType,
329 }
330 case *v1alphareflectionpb.ServerReflectionRequest_ListServices:
331 v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_ListServices{
332 ListServices: mr.ListServices,
333 }
334 default:
335 // no value set
336 }
337 return &v1
338}
339
340// V1ToV1AlphaRequest converts a v1 ServerReflectionRequest to a v1alpha.
341func V1ToV1AlphaRequest(v1 *v1reflectionpb.ServerReflectionRequest) *v1alphareflectionpb.ServerReflectionRequest {

Callers 2

RecvMethod · 0.92
V1AlphaToV1ResponseFunction · 0.85

Calls 2

GetContainingTypeMethod · 0.45
GetExtensionNumberMethod · 0.45

Tested by

no test coverage detected