From 8a593bd3600f8ed21a125762a2328983715a7053 Mon Sep 17 00:00:00 2001 From: siddontang Date: Wed, 7 May 2014 16:57:51 +0800 Subject: [PATCH] iterator add skip --- leveldb/iterator.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/leveldb/iterator.go b/leveldb/iterator.go index bb076d1..3de0965 100644 --- a/leveldb/iterator.go +++ b/leveldb/iterator.go @@ -136,6 +136,14 @@ func (it *Iterator) Next() { } } +func (it *Iterator) Skip(offset int64) { + for i := 0; i < offset; i++ { + if it.Valid() { + it.Next() + } + } +} + func (it *Iterator) Key() []byte { return it.it.Key() }