hyperdrive icon indicating copy to clipboard operation
hyperdrive copied to clipboard

Add `rename` method

Open RangerMauve opened this issue 1 year ago • 0 comments

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?

RangerMauve avatar Jan 12 '24 19:01 RangerMauve