mirror of
https://github.com/jimeh/rbheap.git
synced 2026-02-19 04:46:40 +00:00
Stop printing JSON when end of offsets is reached
This commit is contained in:
10
obj/dump.go
10
obj/dump.go
@@ -71,6 +71,12 @@ func (s *Dump) PrintEntryJSON(indexes []*string) error {
|
||||
}
|
||||
|
||||
offsets := s.sortedOffsets(indexes)
|
||||
offsetsLength := int64(len(offsets))
|
||||
|
||||
if offsetsLength == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var current int64
|
||||
var offset int64 = -1
|
||||
reader := bufio.NewReader(file)
|
||||
@@ -87,6 +93,10 @@ func (s *Dump) PrintEntryJSON(indexes []*string) error {
|
||||
current++
|
||||
fmt.Print(string(line))
|
||||
}
|
||||
|
||||
if current >= offsetsLength-1 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user