Skip to content

Add rename method #364

@RangerMauve

Description

@RangerMauve

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions