0.1.3 • Published 1 year ago

lmdb-move v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

lmdb-move

Moves one LMDB key value to another, i.e. renames, within the scope of a transaction

Installation

npm install lmdb-move

Usage

import {open} from "lmdb";
import {withExtensions} from "lmdb-move";

const db = withExtensions(open("test"));
await db.put("key1","value1");
await db.move("key1","key2");

API

async db.move(key:lmdbKey,destKey:lmdbKey,?overwrite:boolean,?version:number,?ifVersion:number) - returns boolean

Moves the value at key to destKey with the optional version. If overwrite is true and destKey already exists, it will be overwritten. Otherwise, an Error is thrown. If key does not exist an Error is thrown. If optional ifVersion does not match current version, the function returns false.

withExtensions(db:lmdbDatabase,extensions:object) - returns lmdbDatabase`

Extends an LMDB database and any child databases it opens to have the extensions provided as well as any child databases it opens. This utility is common to other lmdb extensions like lmdb-patch, lmdb-copy, lmdb-move.

Testing

Unit testing is conducted with Jest.

File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files66.6657.14100100
index.js66.6657.141001003-11

Release Notes (Reverse Chronological Order)

2023-05-02 v0.1.3 Updated license.

2023-04-27 v0.1.2 Simplified use of withExtensions.

2023-04-24 v0.1.1 Documentation formatting.

2023-04-20 v0.1.0 Now throws if key does not exist to move.

2023-04-19 v0.0.1 Initial public release

License

This software is provided as-is under the MIT license.

Copyright (c) 2023, AnyWhichWay, LLC and Simon Y. Blackwell.

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.1

1 year ago