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

Commit 2df2a44

Browse files
committed
Remove legacy range options from readme and tests (Level/community#86)
1 parent 762d989 commit 2df2a44

File tree

2 files changed

+32
-38
lines changed

2 files changed

+32
-38
lines changed

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,6 @@ You can supply an options object as the first parameter to `createReadStream()`
375375

376376
- `values` _(boolean, default: `true`)_: whether the results should contain values. If set to `true` and `keys` set to `false` then results will simply be values, rather than objects with a `value` property. Used internally by the `createValueStream()` method.
377377

378-
Legacy options:
379-
380-
- `start`: instead use `gte`
381-
382-
- `end`: instead use `lte`
383-
384378
<a name="createKeyStream"></a>
385379

386380
### `db.createKeyStream([options])`

test/read-stream-test.js

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ module.exports = function (test, testCommon) {
166166
})
167167
}))
168168

169-
test('ReadStream: readStream() with "start"', makeTest(function (t, db, ctx, done) {
169+
test('ReadStream: readStream() with "gte"', makeTest(function (t, db, ctx, done) {
170170
db.batch(ctx.sourceData.slice(), function (err) {
171171
t.ifError(err)
172172

173-
const rs = createReadStream(db, { start: '50' })
173+
const rs = createReadStream(db, { gte: '50' })
174174
rs.on('data', ctx.dataSpy)
175175
rs.on('end', ctx.endSpy)
176176
rs.on('close', function () {
@@ -181,11 +181,11 @@ module.exports = function (test, testCommon) {
181181
})
182182
}))
183183

184-
test('ReadStream: readStream() with "start" and "reverse=true"', makeTest(function (t, db, ctx, done) {
184+
test('ReadStream: readStream() with "lte" and "reverse=true"', makeTest(function (t, db, ctx, done) {
185185
db.batch(ctx.sourceData.slice(), function (err) {
186186
t.ifError(err)
187187

188-
const rs = createReadStream(db, { start: '50', reverse: true })
188+
const rs = createReadStream(db, { lte: '50', reverse: true })
189189
rs.on('data', ctx.dataSpy)
190190
rs.on('end', ctx.endSpy)
191191
rs.on('close', function () {
@@ -196,12 +196,12 @@ module.exports = function (test, testCommon) {
196196
})
197197
}))
198198

199-
test('ReadStream: readStream() with "start" being mid-way key (float)', makeTest(function (t, db, ctx, done) {
199+
test('ReadStream: readStream() with "gte" being mid-way key (float)', makeTest(function (t, db, ctx, done) {
200200
db.batch(ctx.sourceData.slice(), function (err) {
201201
t.ifError(err)
202202

203203
// '49.5' doesn't actually exist but we expect it to start at '50' because '49' < '49.5' < '50' (in string terms as well as numeric)
204-
const rs = createReadStream(db, { start: '49.5' })
204+
const rs = createReadStream(db, { gte: '49.5' })
205205
rs.on('data', ctx.dataSpy)
206206
rs.on('end', ctx.endSpy)
207207
rs.on('close', function () {
@@ -212,11 +212,11 @@ module.exports = function (test, testCommon) {
212212
})
213213
}))
214214

215-
test('ReadStream: readStream() with "start" being mid-way key (float) and "reverse=true"', makeTest(function (t, db, ctx, done) {
215+
test('ReadStream: readStream() with "lte" being mid-way key (float) and "reverse=true"', makeTest(function (t, db, ctx, done) {
216216
db.batch(ctx.sourceData.slice(), function (err) {
217217
t.ifError(err)
218218

219-
const rs = createReadStream(db, { start: '49.5', reverse: true })
219+
const rs = createReadStream(db, { lte: '49.5', reverse: true })
220220
rs.on('data', ctx.dataSpy)
221221
rs.on('end', ctx.endSpy)
222222
rs.on('close', function () {
@@ -227,13 +227,13 @@ module.exports = function (test, testCommon) {
227227
})
228228
}))
229229

230-
test('ReadStream: readStream() with "start" being mid-way key (string)', makeTest(function (t, db, ctx, done) {
230+
test('ReadStream: readStream() with "gte" being mid-way key (string)', makeTest(function (t, db, ctx, done) {
231231
db.batch(ctx.sourceData.slice(), function (err) {
232232
t.ifError(err)
233233

234234
// '499999' doesn't actually exist but we expect it to start at '50' because '49' < '499999' < '50' (in string terms)
235235
// the same as the previous test but we're relying solely on string ordering
236-
const rs = createReadStream(db, { start: '499999' })
236+
const rs = createReadStream(db, { gte: '499999' })
237237
rs.on('data', ctx.dataSpy)
238238
rs.on('end', ctx.endSpy)
239239
rs.on('close', function () {
@@ -244,11 +244,11 @@ module.exports = function (test, testCommon) {
244244
})
245245
}))
246246

247-
test('ReadStream: readStream() with "end"', makeTest(function (t, db, ctx, done) {
247+
test('ReadStream: readStream() with "lte"', makeTest(function (t, db, ctx, done) {
248248
db.batch(ctx.sourceData.slice(), function (err) {
249249
t.ifError(err)
250250

251-
const rs = createReadStream(db, { end: '50' })
251+
const rs = createReadStream(db, { lte: '50' })
252252
rs.on('data', ctx.dataSpy)
253253
rs.on('end', ctx.endSpy)
254254
rs.on('close', function () {
@@ -259,11 +259,11 @@ module.exports = function (test, testCommon) {
259259
})
260260
}))
261261

262-
test('ReadStream: readStream() with "end" being mid-way key (float)', makeTest(function (t, db, ctx, done) {
262+
test('ReadStream: readStream() with "lte" being mid-way key (float)', makeTest(function (t, db, ctx, done) {
263263
db.batch(ctx.sourceData.slice(), function (err) {
264264
t.ifError(err)
265265

266-
const rs = createReadStream(db, { end: '50.5' })
266+
const rs = createReadStream(db, { lte: '50.5' })
267267
rs.on('data', ctx.dataSpy)
268268
rs.on('end', ctx.endSpy)
269269
rs.on('close', function () {
@@ -274,11 +274,11 @@ module.exports = function (test, testCommon) {
274274
})
275275
}))
276276

277-
test('ReadStream: readStream() with "end" being mid-way key (string)', makeTest(function (t, db, ctx, done) {
277+
test('ReadStream: readStream() with "lte" being mid-way key (string)', makeTest(function (t, db, ctx, done) {
278278
db.batch(ctx.sourceData.slice(), function (err) {
279279
t.ifError(err)
280280

281-
const rs = createReadStream(db, { end: '50555555' })
281+
const rs = createReadStream(db, { lte: '50555555' })
282282
rs.on('data', ctx.dataSpy)
283283
rs.on('end', ctx.endSpy)
284284
rs.on('close', function () {
@@ -289,11 +289,11 @@ module.exports = function (test, testCommon) {
289289
})
290290
}))
291291

292-
test('ReadStream: readStream() with "end" being mid-way key (float) and "reverse=true"', makeTest(function (t, db, ctx, done) {
292+
test('ReadStream: readStream() with "gte" being mid-way key (float) and "reverse=true"', makeTest(function (t, db, ctx, done) {
293293
db.batch(ctx.sourceData.slice(), function (err) {
294294
t.ifError(err)
295295

296-
const rs = createReadStream(db, { end: '50.5', reverse: true })
296+
const rs = createReadStream(db, { gte: '50.5', reverse: true })
297297
rs.on('data', ctx.dataSpy)
298298
rs.on('end', ctx.endSpy)
299299
rs.on('close', function () {
@@ -303,11 +303,11 @@ module.exports = function (test, testCommon) {
303303
})
304304
}))
305305

306-
test('ReadStream: readStream() with both "start" and "end"', makeTest(function (t, db, ctx, done) {
306+
test('ReadStream: readStream() with both "gte" and "lte"', makeTest(function (t, db, ctx, done) {
307307
db.batch(ctx.sourceData.slice(), function (err) {
308308
t.ifError(err)
309309

310-
const rs = createReadStream(db, { start: 30, end: 70 })
310+
const rs = createReadStream(db, { gte: 30, lte: 70 })
311311
rs.on('data', ctx.dataSpy)
312312
rs.on('end', ctx.endSpy)
313313
rs.on('close', function () {
@@ -318,11 +318,11 @@ module.exports = function (test, testCommon) {
318318
})
319319
}))
320320

321-
test('ReadStream: readStream() with both "start" and "end" and "reverse=true"', makeTest(function (t, db, ctx, done) {
321+
test('ReadStream: readStream() with both "gte" and "lte" and "reverse=true"', makeTest(function (t, db, ctx, done) {
322322
db.batch(ctx.sourceData.slice(), function (err) {
323323
t.ifError(err)
324324

325-
const rs = createReadStream(db, { start: 70, end: 30, reverse: true })
325+
const rs = createReadStream(db, { gte: 30, lte: 70, reverse: true })
326326
rs.on('data', ctx.dataSpy)
327327
rs.on('end', ctx.endSpy)
328328
rs.on('close', function () {
@@ -371,11 +371,11 @@ module.exports = function (test, testCommon) {
371371
})
372372
}))
373373

374-
test('ReadStream: ReadStream, start=0', makeTest(function (t, db, ctx, done) {
374+
test('ReadStream: ReadStream, gte=0', makeTest(function (t, db, ctx, done) {
375375
db.batch(ctx.sourceData.slice(), function (err) {
376376
t.ifError(err)
377377

378-
const rs = createReadStream(db, { start: 0 })
378+
const rs = createReadStream(db, { gte: 0 })
379379
rs.on('data', ctx.dataSpy)
380380
rs.on('end', ctx.endSpy)
381381
rs.on('close', function () {
@@ -387,11 +387,11 @@ module.exports = function (test, testCommon) {
387387

388388
// we don't expect any data to come out of here because the keys start at '00' not 0
389389
// we just want to ensure that we don't kill the process
390-
test('ReadStream: ReadStream, end=0', makeTest(function (t, db, ctx, done) {
390+
test('ReadStream: ReadStream, lte=0', makeTest(function (t, db, ctx, done) {
391391
db.batch(ctx.sourceData.slice(), function (err) {
392392
t.ifError(err)
393393

394-
const rs = createReadStream(db, { end: 0 })
394+
const rs = createReadStream(db, { lte: 0 })
395395
rs.on('data', ctx.dataSpy)
396396
rs.on('end', ctx.endSpy)
397397
rs.on('close', function () {
@@ -451,11 +451,11 @@ module.exports = function (test, testCommon) {
451451
})
452452
}))
453453

454-
test('ReadStream: readStream() with "start" and "limit"', makeTest(function (t, db, ctx, done) {
454+
test('ReadStream: readStream() with "gte" and "limit"', makeTest(function (t, db, ctx, done) {
455455
db.batch(ctx.sourceData.slice(), function (err) {
456456
t.ifError(err)
457457

458-
const rs = createReadStream(db, { start: '20', limit: 20 })
458+
const rs = createReadStream(db, { gte: '20', limit: 20 })
459459
rs.on('data', ctx.dataSpy)
460460
rs.on('end', ctx.endSpy)
461461
rs.on('close', function () {
@@ -465,11 +465,11 @@ module.exports = function (test, testCommon) {
465465
})
466466
}))
467467

468-
test('ReadStream: readStream() with "end" after "limit"', makeTest(function (t, db, ctx, done) {
468+
test('ReadStream: readStream() with "lte" after "limit"', makeTest(function (t, db, ctx, done) {
469469
db.batch(ctx.sourceData.slice(), function (err) {
470470
t.ifError(err)
471471

472-
const rs = createReadStream(db, { end: '50', limit: 20 })
472+
const rs = createReadStream(db, { lte: '50', limit: 20 })
473473
rs.on('data', ctx.dataSpy)
474474
rs.on('end', ctx.endSpy)
475475
rs.on('close', function () {
@@ -479,11 +479,11 @@ module.exports = function (test, testCommon) {
479479
})
480480
}))
481481

482-
test('ReadStream: readStream() with "end" before "limit"', makeTest(function (t, db, ctx, done) {
482+
test('ReadStream: readStream() with "lte" before "limit"', makeTest(function (t, db, ctx, done) {
483483
db.batch(ctx.sourceData.slice(), function (err) {
484484
t.ifError(err)
485485

486-
const rs = createReadStream(db, { end: '30', limit: 50 })
486+
const rs = createReadStream(db, { lte: '30', limit: 50 })
487487
rs.on('data', ctx.dataSpy)
488488
rs.on('end', ctx.endSpy)
489489
rs.on('close', function () {

0 commit comments

Comments
 (0)