1.0.2 • Published 12 months ago

lmdb-copy v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

lmdb-copy

Copies one LMDB key value to another.

Installation

npm install lmdb-move

Usage

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

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

API

async copy(key,destKey,?overwrite,?version,?ifVersion) - returns boolean

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.

withExtensions(db:lmdbDatabase,extenstions: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-move.

Automatically adds copy.

Testing

Unit testing is conducted with Jest.

File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files92.8592.3100100
index.js92.8592.310010021

Release Notes (Reverse Chronological Order)

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

License

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

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

1.0.2

12 months ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago