trie: add sub-trie iterator with prefix and range iteration support

This commit is contained in:
samuel 2025-09-10 14:25:58 +01:00 committed by Gary Rong
parent f125dbd9c7
commit 2db2a18e83
3 changed files with 59 additions and 58 deletions

View file

@ -1015,8 +1015,9 @@ func TestPrefixIteratorWithDescend(t *testing.T) {
} }
// We should still respect the prefix boundary even when skipping // We should still respect the prefix boundary even when skipping
prefix := []byte("a")
for key := range leafsFound { for key := range leafsFound {
if !bytes.HasPrefix([]byte(key), []byte("a")) { if !bytes.HasPrefix([]byte(key), prefix) {
t.Errorf("Found key outside prefix when using descend=false: %s", key) t.Errorf("Found key outside prefix when using descend=false: %s", key)
} }
} }