Skip to content

Commit

Permalink
**minor breaking change**: embed struct rather than name it
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
twmb committed Jul 15, 2021
1 parent 23d1e41 commit ffc94ea
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/kgo/record_and_fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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],
})
}
}
Expand Down Expand Up @@ -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)
}
}

0 comments on commit ffc94ea

Please sign in to comment.