Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

Commit 83c2fd8

Browse files
greenkeeper[bot]vweevers
authored andcommitted
Upgrade abstract-leveldown from ~6.0.3 to ~6.1.1 (#660)
* Upgrade abstract-leveldown from ~6.0.3 to ~6.1.1 * Opt-in to new clear() tests * Document new clear() method
1 parent c4f0735 commit 83c2fd8

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ If you don't want to use the prebuilt binary for the platform you are installing
6767
- <a href="#leveldown_compactRange"><code>db.<b>compactRange()</b></code></a>
6868
- <a href="#leveldown_getProperty"><code>db.<b>getProperty()</b></code></a>
6969
- <a href="#leveldown_iterator"><code>db.<b>iterator()</b></code></a>
70+
- <a href="#leveldown_clear"><code>db.<b>clear()</b></code></a>
7071
- <a href="#chainedbatch"><code>chainedBatch</code></a>
7172
- <a href="#chainedbatch_put"><code>chainedBatch.<b>put()</b></code></a>
7273
- <a href="#chainedbatch_del"><code>chainedBatch.<b>del()</b></code></a>
@@ -275,6 +276,19 @@ Returns a new [`iterator`](#iterator) instance. The optional `options` object ma
275276

276277
- `valueAsBuffer` (boolean, default: `true`): Used to determine whether to return the `value` of each entry as a string or a Buffer.
277278

279+
<a name="leveldown_clear"></a>
280+
281+
### `db.clear([options, ]callback)`
282+
283+
Delete all entries or a range. Not guaranteed to be atomic. Accepts the following range options (with the same rules as on iterators):
284+
285+
- `gt` (greater than), `gte` (greater than or equal) define the lower bound of the range to be deleted. Only entries where the key is greater than (or equal to) this option will be included in the range. When `reverse=true` the order will be reversed, but the entries deleted will be the same.
286+
- `lt` (less than), `lte` (less than or equal) define the higher bound of the range to be deleted. Only entries where the key is less than (or equal to) this option will be included in the range. When `reverse=true` the order will be reversed, but the entries deleted will be the same.
287+
- `reverse` _(boolean, default: `false`)_: delete entries in reverse order. Only effective in combination with `limit`, to remove the last N records.
288+
- `limit` _(number, default: `-1`)_: limit the number of entries to be deleted. This number represents a _maximum_ number of entries and may not be reached if you get to the end of the range first. A value of `-1` means there is no limit. When `reverse=true` the entries with the highest keys will be deleted instead of the lowest keys.
289+
290+
If no options are provided, all entries will be deleted. The `callback` function will be called with no arguments if the operation was successful or with an `Error` if it failed for any reason.
291+
278292
<a name="chainedbatch"></a>
279293

280294
### `chainedBatch`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"prebuild-alpine": "IMAGE=alpine ./scripts/cross-compile --tag-libc"
2626
},
2727
"dependencies": {
28-
"abstract-leveldown": "~6.0.3",
28+
"abstract-leveldown": "~6.1.1",
2929
"napi-macros": "~2.0.0",
3030
"node-gyp-build": "~4.1.0"
3131
},

test/common.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ module.exports = suite.common({
77
test: test,
88
factory: function () {
99
return leveldown(tempy.directory())
10-
}
10+
},
11+
12+
// Opt-in to new clear() tests
13+
clear: true
1114
})

0 commit comments

Comments
 (0)