From ffc94ea1836b32d41cca7c1090773e1894b7b07f Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Wed, 14 Jul 2021 21:12:45 -0600 Subject: [PATCH] **minor breaking change**: embed struct rather than name it This simplifies usage. I'm not quite sure why this was not the original implementation. I don't think anybody used this type yet, but the fix is extremely simple. --- pkg/kgo/record_and_fetch.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/kgo/record_and_fetch.go b/pkg/kgo/record_and_fetch.go index 31522cb5..953c0af8 100644 --- a/pkg/kgo/record_and_fetch.go +++ b/pkg/kgo/record_and_fetch.go @@ -393,8 +393,8 @@ func (fs Fetches) EachPartition(fn func(FetchTopicPartition)) { for _, topic := range fetch.Topics { for i := range topic.Partitions { fn(FetchTopicPartition{ - Topic: topic.Topic, - Partition: topic.Partitions[i], + Topic: topic.Topic, + FetchPartition: topic.Partitions[i], }) } } @@ -447,13 +447,13 @@ func (fs Fetches) EachRecord(fn func(*Record)) { type FetchTopicPartition struct { // Topic is the topic this is for. Topic string - // Partition is an individual partition within this topic. - Partition FetchPartition + // FetchPartition is an individual partition within this topic. + FetchPartition } // EachRecord calls fn for each record in the topic's partition. func (r *FetchTopicPartition) EachRecord(fn func(*Record)) { - for _, r := range r.Partition.Records { + for _, r := range r.Records { fn(r) } }