Merge pull request #1654 from ogaclejapan/fix-open-flags
Fix wrong answer
This commit is contained in:
commit
2483af0eda
1 changed files with 7 additions and 7 deletions
|
@ -470,9 +470,9 @@ Methods that involve searching support either exact keys or so-called "range que
|
|||
|
||||
Ranges are created using following calls:
|
||||
|
||||
- `IDBKeyRange.lowerBound(lower, [open])` means: `>lower` (or `≥lower` if `open` is true)
|
||||
- `IDBKeyRange.upperBound(upper, [open])` means: `<upper` (or `≤upper` if `open` is true)
|
||||
- `IDBKeyRange.bound(lower, upper, [lowerOpen], [upperOpen])` means: between `lower` and `upper`, with optional equality if the corresponding `open` is true.
|
||||
- `IDBKeyRange.lowerBound(lower, [open])` means: `≥lower` (or `>lower` if `open` is true)
|
||||
- `IDBKeyRange.upperBound(upper, [open])` means: `≤upper` (or `<upper` if `open` is true)
|
||||
- `IDBKeyRange.bound(lower, upper, [lowerOpen], [upperOpen])` means: between `lower` and `upper`. If the open flags is true, the corresponding key is not included in the range.
|
||||
- `IDBKeyRange.only(key)` -- a range that consists of only one `key`, rarely used.
|
||||
|
||||
All searching methods accept a `query` argument that can be either an exact key or a key range:
|
||||
|
@ -491,16 +491,16 @@ Request examples:
|
|||
// get one book
|
||||
books.get('js')
|
||||
|
||||
// get books with 'css' < id < 'html'
|
||||
// get books with 'css' <= id <= 'html'
|
||||
books.getAll(IDBKeyRange.bound('css', 'html'))
|
||||
|
||||
// get books with 'html' <= id
|
||||
// get books with 'html' < id
|
||||
books.getAll(IDBKeyRange.lowerBound('html', true))
|
||||
|
||||
// get all books
|
||||
books.getAll()
|
||||
|
||||
// get all keys: id >= 'js'
|
||||
// get all keys: id > 'js'
|
||||
books.getAllKeys(IDBKeyRange.lowerBound('js', true))
|
||||
```
|
||||
|
||||
|
@ -580,7 +580,7 @@ request.onsuccess = function() {
|
|||
We can also use `IDBKeyRange` to create ranges and looks for cheap/expensive books:
|
||||
|
||||
```js
|
||||
// find books where price < 5
|
||||
// find books where price <= 5
|
||||
let request = priceIndex.getAll(IDBKeyRange.upperBound(5));
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue