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

Function equalRecords

protocol/record_batch_test.go:165–189  ·  view source on GitHub ↗
(r1, r2 *Record)

Source from the content-addressed store, hash-verified

163}
164
165func equalRecords(r1, r2 *Record) bool {
166 if r1.Offset != r2.Offset {
167 return false
168 }
169
170 if !r1.Time.Equal(r2.Time) {
171 return false
172 }
173
174 k1 := readAll(r1.Key)
175 k2 := readAll(r2.Key)
176
177 if !reflect.DeepEqual(k1, k2) {
178 return false
179 }
180
181 v1 := readAll(r1.Value)
182 v2 := readAll(r2.Value)
183
184 if !reflect.DeepEqual(v1, v2) {
185 return false
186 }
187
188 return reflect.DeepEqual(r1.Headers, r2.Headers)
189}
190
191func readAll(bytes Bytes) []byte {
192 if bytes != nil {

Callers 1

assertRecordsFunction · 0.85

Calls 1

readAllFunction · 0.70

Tested by

no test coverage detected