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

Implement has() and hasMany() #111

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Implement has() and hasMany() #111

wants to merge 1 commit into from

Conversation

vweevers
Copy link
Member

Adds support of two methods:

await db.put('love', 'u')
await db.has('love') // true
await db.hasMany(['love', 'hate']) // [true, false]

Depends on a pending abstract-level release, and lacks support of explicit snapshots which should be implemented after #110 lands.

Ref: Level/community#142

Adds support of two methods:

```js
await db.put('love', 'u')
await db.has('love') // true
await db.hasMany(['love', 'hate']) // [true, false]
```

Depends on a pending `abstract-level` release, and lacks support of
explicit snapshots which should be implemented after #110 lands.

Ref: Level/community#142
@vweevers vweevers added enhancement New feature or request semver-minor New features that are backward compatible labels Dec 29, 2024

for (const std::string& key: keys_) {
std::string value;
leveldb::Status status = database_->Get(options_, key, value);
Copy link
Member Author

Choose a reason for hiding this comment

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

It might be faster to use an iterator (if the LevelDB iterator lazily reads values thus allowing us to skip that; not sure) but it would add some complexity so I'll save that for a future PR (or for anyone who wants to take a stab at that).

Copy link
Member Author

Choose a reason for hiding this comment

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

Get() copies the value while an iterator would not. So should indeed use an iterator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver-minor New features that are backward compatible
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

1 participant