MCPcopy
hub / github.com/segmentio/kafka-go / forEachField

Function forEachField

protocol/prototest/reflect.go:70–92  ·  view source on GitHub ↗
(v reflect.Value, do func(reflect.Value))

Source from the content-addressed store, hash-verified

68}
69
70func forEachField(v reflect.Value, do func(reflect.Value)) {
71 for v.Kind() == reflect.Ptr {
72 if v.IsNil() {
73 return
74 }
75 v = v.Elem()
76 }
77
78 switch v.Kind() {
79 case reflect.Slice:
80 for i, n := 0, v.Len(); i < n; i++ {
81 forEachField(v.Index(i), do)
82 }
83
84 case reflect.Struct:
85 for i, n := 0, v.NumField(); i < n; i++ {
86 forEachField(v.Field(i), do)
87 }
88
89 default:
90 do(v)
91 }
92}
93
94type memoryRecord struct {
95 offset int64

Callers 2

closeMessageFunction · 0.85
loadValueFunction · 0.85

Calls 1

LenMethod · 0.65

Tested by

no test coverage detected