-
Notifications
You must be signed in to change notification settings - Fork 30
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 ability to iterate over all Lists in the PickleDB #32
base: master
Are you sure you want to change the base?
Conversation
@landhb thank you for working on this! I'm thinking if there's a way to make it backward compatible - maybe preserve the old list iterator (and mark it as deprecated) and introduce new iterators? This way users can enjoy this new feature and at the same time it won't break anything for existing usage. Let me know what you think |
Hey @seladb sorry for the late response. I'll see if I can feature gate it and add deprecation warnings. |
@seladb Finally got some time to come back to this. I've added the deprecation warning, and by default all old code using
To use the newer version of |
Thank you @landhb ! I'm a little bit busy right now but I'll take a look soon |
This is definitely a breaking change, and would require a major version bump, since it changes a few of the existing types and methods. But I think this might be a more intuitive naming scheme for the list iterators.
The updated types are:
PickleDbListIterator
: Iterates over all lists in the DBPickleDbListItemIterator
: Iterates over items in a specific listPickleDbListItem
: Item yielded from a listUpdates in this PR to make these changes:
PickleDb::liter()
is now namedPickleDb::liter_get()
to obtain an iterator over a specific list.PickleDbListIterator
is now namedPickleDbListItemIterator
since it iterates over items in a list.PickleDb::liter()
to produce an iterator over all lists in the db (the newPickleDbListIterator
)PickleDbListIterator
that yields an iterator per listPickleDbListItemIterator