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

Function isStructField

go/fory/field_info.go:518–539  ·  view source on GitHub ↗

isStructField checks if a type is a struct type (directly or via pointer) excluding unions.

(t reflect.Type)

Source from the content-addressed store, hash-verified

516
517// isStructField checks if a type is a struct type (directly or via pointer) excluding unions.
518func isStructField(t reflect.Type) bool {
519 if t == nil {
520 return false
521 }
522 if info, ok := getOptionalInfo(t); ok {
523 t = info.valueType
524 }
525 if t.Kind() == reflect.Ptr {
526 t = t.Elem()
527 }
528 if isUnionType(t) {
529 return false
530 }
531 // Date/Timestamp are built-in types with dedicated encodings, not user structs.
532 if t == dateType || t == timestampType || t == decimalType {
533 return false
534 }
535 if t.Kind() == reflect.Struct {
536 return true
537 }
538 return false
539}
540
541// isSetReflectType checks if a reflect.Type is a Set type (map[T]struct{})
542// fory.Set[T] is defined as map[T]struct{} where the value type is empty struct

Callers 2

skipFieldMethod · 0.85
initFieldsFromTypeDefMethod · 0.85

Calls 3

getOptionalInfoFunction · 0.85
isUnionTypeFunction · 0.85
KindMethod · 0.80

Tested by

no test coverage detected