-
Notifications
You must be signed in to change notification settings - Fork 5
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
[feature request] add a generator for getAllKeys
?
#1
Comments
Hello Huan! The exact api you proposed here isn't possible as far as I know, my knowledge of In any case, I was able to put something together that might work for you. I haven't pushed this to NPM yet, wanted to make sure this fits your use case well enough. There are four new methods:
All of them return a const it = await db.getAllKeysIt();
for await (const key of it) {
console.info(key)
} Let me know if this works! You can grab the current master and compile it to try it out. |
Hi Scott! It's so great that your response as fast as light! I'll check it out and get back to you for the result, thank you very much for the quick improvements! |
BTW: Could we also consider to add search options for the In leveldb, we can use the following options with the iterator: export interface IteratorOptions {
gt? : any,
gte? : any,
lt? : any,
lte? : any,
reverse? : boolean,
limit? : number,
prefix? : any,
} Here's more documentation from level README: https://github.com/Level/level#dbcreatereadstreamoptions |
The iterator code seems works, however, my unit tests had not been passed yet. Please see #3 |
There's a new method called The arguments are: export interface QueryArgs<K> {
gt?: K;
gte?: K;
lt?: K;
lte?: K;
offset?: number;
limit?: number;
values?: boolean;
reverse?: boolean;
} |
|
My library had switched to SnapDB and all unit tests had been passed, published to NPM now! Thank you so much, Scott! See: https://github.com/huan/flash-store/#v016-may-2019---snapdb-as-backend |
Hello,
I really love your idea about
pure javascript
,zero dependencies
, andleveldb performance
.I want to switch my project to his library, however, I found that it leaks a
generator
function forgetAllKeys
(andgetAll
andrange
as well).To demonstrate in code, I need a code snip work like the following:
Which should be defined in the class
SnapDb
like the following:Could you please consider adding the generator interface to the library? Because it would be really convenient for the end-users.
I would love to add this feature by creating a PR if you like.
The text was updated successfully, but these errors were encountered: