fix: stop iter if prefix not matched

This commit is contained in:
Xie Yanbo 2019-11-16 19:35:02 +08:00
parent 177190b311
commit 9d67cd79c8
1 changed files with 2 additions and 0 deletions

View File

@ -126,6 +126,8 @@ iterator iterPrefix*(self: LevelDb, prefix: string): (string, string) =
for (key, value) in iter(self, prefix, reverse = false):
if key.startsWith(prefix):
yield (key, value)
else:
break
iterator iterRange*(self: LevelDb, start, limit: string): (string, string) =
let reverse: bool = limit < start