isStructField checks if a type is a struct type (directly or via pointer) excluding unions.
(t reflect.Type)
| 516 | |
| 517 | // isStructField checks if a type is a struct type (directly or via pointer) excluding unions. |
| 518 | func 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 |
no test coverage detected