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

Function needsUnionEncodingOverride

go/fory/union.go:343–360  ·  view source on GitHub ↗
(caseType reflect.Type, caseTypeID TypeId, defaultTypeID TypeId)

Source from the content-addressed store, hash-verified

341}
342
343func needsUnionEncodingOverride(caseType reflect.Type, caseTypeID TypeId, defaultTypeID TypeId) bool {
344 if caseTypeID == defaultTypeID {
345 return false
346 }
347 base := caseType
348 if base.Kind() == reflect.Ptr {
349 base = base.Elem()
350 }
351 switch base.Kind() {
352 case reflect.Int32, reflect.Uint32, reflect.Int64, reflect.Uint64:
353 if isNumericEncodingTypeID(caseTypeID) {
354 if defaultTypeID == 0 || isNumericEncodingTypeID(defaultTypeID) {
355 return true
356 }
357 }
358 }
359 return false
360}
361
362func isNumericEncodingTypeID(typeID TypeId) bool {
363 switch typeID {

Callers 1

initializeMethod · 0.85

Calls 2

isNumericEncodingTypeIDFunction · 0.85
KindMethod · 0.80

Tested by

no test coverage detected