huan / flash-store

FlashStore is a high-performance Key-Value Persistent Local Database using ES6 Map's API (Async & Sync), Powered by LevelDB/RocksDB/SQLite and TypeScript.
https://paka.dev/npm/flash-store
Apache License 2.0
20 stars 4 forks source link

falshStore.value() cannot work as expect #4

Open lijiarui opened 6 years ago

lijiarui commented 6 years ago

in flashStore.values, {lte: 10} result is 3, while {gte: 10} result is 5

snip as follows:

import { FlashStore } from '../src/flash-store'
async function main() {
  const flashStore = new FlashStore('falshstore.workdir')

  console.log('all values')
  for await (const value of flashStore.values()) {
    console.log(value)
  }

  console.log('value gte 10')
  for await (const value of flashStore.values({gte: 10})) {
    console.log(value)
  }

  console.log('value lte 10')
  for await (const value of flashStore.values({lte: 10})) {
    console.log(value)
  }

}
main()

output as follows:

all values
3
5
value gte 10
5
value lte 10
3
huan commented 4 years ago

Confirmed, and added to known issues.

It seems that we are not passing the right parameters to the leveldown abstract API (to be confirmed).