Add ability to iterate over all Lists in the PickleDB#32
Add ability to iterate over all Lists in the PickleDB#32landhb wants to merge 8 commits intoseladb:masterfrom
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.PickleDbListIteratoris now namedPickleDbListItemIteratorsince it iterates over items in a list.PickleDb::liter()to produce an iterator over all lists in the db (the newPickleDbListIterator)PickleDbListIteratorthat yields an iterator per listPickleDbListItemIterator