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 rename method #364

Open
RangerMauve opened this issue Jan 12, 2024 · 0 comments
Open

Add rename method #364

RangerMauve opened this issue Jan 12, 2024 · 0 comments

Comments

@RangerMauve
Copy link
Contributor

It'd be useful to have an easy way to move entries to new locations. At the moment one needs to either duplicate data and delete the old data in a batch, or mess with internal APIs.

I propose something like this:

async rename(src, dst) {
  const entry = await this.entry(src)
  const batch = this.db.batch()
  batch.del(src)
  batch.put(dst, entry)
  batch.flush()
}

Would a PR that adds a working method as well as unit tests work for y'all?

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

No branches or pull requests

1 participant