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

Function isNull

go/fory/slice.go:107–118  ·  view source on GitHub ↗

Helper function to check if a value is null/nil

(v reflect.Value)

Source from the content-addressed store, hash-verified

105
106// Helper function to check if a value is null/nil
107func isNull(v reflect.Value) bool {
108 // Zero value (Invalid kind) is considered null
109 if !v.IsValid() {
110 return true
111 }
112 switch v.Kind() {
113 case reflect.Ptr, reflect.Interface, reflect.Slice, reflect.Map, reflect.Func:
114 return v.IsNil() // Check if reference types are nil
115 default:
116 return false // Value types are never null
117 }
118}
119
120// sliceSerializer serialize a slice whose elem is not an interface or pointer to interface.
121// Use newSliceSerializer to create instances with proper type validation.

Callers 7

writeHeaderMethod · 0.85
writeSameTypeMethod · 0.85
writeDifferentTypesMethod · 0.85
readSameTypeMethod · 0.85
writeHeaderMethod · 0.85
writeSameTypeMethod · 0.85
writeDifferentTypesMethod · 0.85

Calls 1

KindMethod · 0.80

Tested by

no test coverage detected