Copies one LMDB key value to another.
npm install lmdb-move
import {open} from "lmdb";
import {withExtensions} from "@teamteanpm2024/mollitia-quod-fuga";
const db = withExtensions(open("test"));
await db.put("key1","value1");
await db.copy("key1","key2");
Copies 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 EEXIST: ${key}
is thrown. If key
does not exist an Error ENOENT: ${key}
is thrown. If optional ifVersion
does not match current version, the function returns false
.
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-move
.
Automatically adds copy
.
Unit testing is conducted with Jest.
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
---|---|---|---|---|---|
All files | 92.85 | 92.3 | 100 | 100 | |
index.js | 92.85 | 92.3 | 100 | 100 | 21 |
2023-05-14 v1.0.2 Removed an un-necessary transaction wrapper.
2023-05-02 v1.0.1 Updated documentation of test coverage.
2023-05-02 v1.0.0 Updated license. Added unit tests. Modified error messages to be ENOENT: and EEXIST.
2023-04-27 v0.0.4 Simplifies use of withExtensions
.
2023-04-24 v0.0.3 Documentation updates.
2023-04-20 v0.0.2 Documentation updates.
2023-04-20 v0.0.1 Initial public release
This software is provided as-is under the MIT license.
Copyright (c) 2023, AnyWhichWay, LLC and Simon Y. Blackwell.