**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.
@@ -394,7 +394,7 @@ func (fs Fetches) EachPartition(fn func(FetchTopicPartition)) {
for i := range topic.Partitions {
fn(FetchTopicPartition{
Topic: topic.Topic,
- Partition: topic.Partitions[i],
+ 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)
}
}
