MCPcopy Create free account
hub / github.com/apache/fory / getOptionalElementType

Function getOptionalElementType

go/fory/codegen/utils.go:67–85  ·  view source on GitHub ↗
(t types.Type)

Source from the content-addressed store, hash-verified

65}
66
67func getOptionalElementType(t types.Type) (types.Type, bool) {
68 t = types.Unalias(t)
69 named, ok := t.(*types.Named)
70 if !ok {
71 return nil, false
72 }
73 obj := named.Obj()
74 if obj == nil || obj.Name() != "Optional" {
75 return nil, false
76 }
77 if obj.Pkg() == nil || obj.Pkg().Path() != "github.com/apache/fory/go/fory/optional" {
78 return nil, false
79 }
80 typeArgs := named.TypeArgs()
81 if typeArgs == nil || typeArgs.Len() != 1 {
82 return nil, false
83 }
84 return typeArgs.At(0), true
85}
86
87// isSupportedFieldType checks if a field type is supported
88func isSupportedFieldType(t types.Type) bool {

Callers 5

isSupportedFieldTypeFunction · 0.85
isPrimitiveTypeFunction · 0.85
getTypeIDFunction · 0.85
getPrimitiveSizeFunction · 0.85
analyzeFieldFunction · 0.85

Calls 1

LenMethod · 0.80

Tested by

no test coverage detected