Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reverse_each method to db #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

luaVolk
Copy link

@luaVolk luaVolk commented Mar 6, 2020

Added method to iterate the db from last to first

iterator.next
end
end
iterator.destroy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iterator should be destroyed in the rescue statement:

private def iterate(reversed : Bool = false) : Void
  iterator = Iterator.new(self)
  ...
rescue
  iterator.destroy
end


out.should eq "k3=v3;k2=v2;k1=v1;"

db.close
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same:

it "..." do
  db = ...
rescue
  db.close
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants