Valid returns false when iteration is done.
()
| 517 | |
| 518 | // Valid returns false when iteration is done. |
| 519 | func (it *Iterator) Valid() bool { |
| 520 | if it.item == nil { |
| 521 | return false |
| 522 | } |
| 523 | if it.opt.prefixIsKey { |
| 524 | return bytes.Equal(it.item.key, it.opt.Prefix) |
| 525 | } |
| 526 | return bytes.HasPrefix(it.item.key, it.opt.Prefix) |
| 527 | } |
| 528 | |
| 529 | // ValidForPrefix returns false when iteration is done |
| 530 | // or when the current key is not prefixed by the specified prefix. |