Class IDBKeyRange
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The IDBKeyRange interface of the IndexedDB API represents a continuous interval over some data type that is used for keys. Records can be retrieved from IDBObjectStore and IDBIndex objects using keys or a range of keys. You can limit the range using lower and upper bounds. For example, you can iterate over all values of a key in the value range A–Z.
[Value("IDBKeyRange")]
public class IDBKeyRange
- Inheritance
-
IDBKeyRange
- Inherited Members
Remarks
A key range can be a single value or a range with upper and lower bounds or endpoints. If the key range has both upper and lower bounds, then it is bounded; if it has no bounds, it is unbounded. A bounded key range can either be open (the endpoints are excluded) or closed (the endpoints are included). To retrieve all keys within a certain range, you can use the following code constructs:
Range | Code |
All keys ≥ x |
|
All keys > x |
|
All keys ≤ y |
|
All keys < y |
|
All keys ≥ x && ≤ y |
|
All keys > x &&< y |
|
All keys > x && ≤ y |
|
All keys ≥ x &&< y |
|
The key = z |
|
A key is in a key range if the following conditions are true:
-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).
Constructors
IDBKeyRange()
public IDBKeyRange()
Properties
Lower
The lower read-only property of the
IDBKeyRange interface returns the lower bound of the key range.
[Value("lower")]
public dynamic Lower { get; }
Property Value
- dynamic
The lower bound of the key range (can be any
type.)
Remarks
-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).
LowerOpen
The lowerOpen read-only property of the
IDBKeyRange interface returns a boolean indicating whether the
lower-bound value is included in the key range.
[Value("lowerOpen")]
public bool LowerOpen { get; }
Property Value
- bool
A boolean value:
Value Indication trueThe lower-bound value is not included in the key range. falseThe lower-bound value is included in the key range.
Remarks
-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).
Upper
The upper read-only property of the
IDBKeyRange interface returns the upper bound of the key range.
[Value("upper")]
public dynamic Upper { get; }
Property Value
- dynamic
The upper bound of the key range (can be any type.)
Remarks
-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).
UpperOpen
The upperOpen read-only property of the
IDBKeyRange interface returns a boolean indicating whether the
upper-bound value is included in the key range.
[Value("upperOpen")]
public bool UpperOpen { get; }
Property Value
- bool
A boolean value:
Value Indication trueThe upper-bound value is not included in the key range. falseThe upper-bound value is included in the key range.
Remarks
-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).
Methods
Bound(dynamic, dynamic, bool, bool)
The bound() static method of the IDBKeyRange
interface creates a new key range with the specified upper and lower bounds. The
bounds can be open (that is, the bounds exclude the endpoint values) or closed (that
is, the bounds include the endpoint values). By default, the bounds are closed.
[Value("bound")]
public static IDBKeyRange Bound(dynamic lower, dynamic upper, bool lowerOpen = false, bool upperOpen = false)
Parameters
Returns
- IDBKeyRange
IDBKeyRange: The newly created key range.
Remarks
-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).
Includes(dynamic)
The includes() method of the IDBKeyRange
interface returns a boolean indicating whether a specified key is inside the key
range.
[Value("includes")]
public bool Includes(dynamic key)
Parameters
keydynamic
Returns
- bool
A boolean value.
Remarks
-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).
LowerBound(dynamic, bool)
The lowerBound() static method of the
IDBKeyRange interface creates a new key range with only a lower bound.
By default, it includes the lower endpoint value and is closed.
[Value("lowerBound")]
public static IDBKeyRange LowerBound(dynamic lower, bool open = false)
Parameters
lowerdynamicopenbool
Returns
- IDBKeyRange
IDBKeyRange: The newly created key range.
Remarks
-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).
Only(dynamic)
The only() static method of the IDBKeyRange
interface creates a new key range containing a single value.
[Value("only")]
public static IDBKeyRange Only(dynamic value)
Parameters
valuedynamic
Returns
- IDBKeyRange
IDBKeyRange: The newly created key range.
Remarks
-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).
UpperBound(dynamic, bool)
The upperBound() static method of the
IDBKeyRange interface creates a new upper-bound key range. By default,
it includes the upper endpoint value and is closed.
[Value("upperBound")]
public static IDBKeyRange UpperBound(dynamic upper, bool open = false)
Parameters
upperdynamicopenbool
Returns
- IDBKeyRange
IDBKeyRange: The newly created key range.
Remarks
-Using IndexedDB
-Starting transactions: IDBDatabase
-Using transactions: IDBTransaction
-Setting a range of keys: IDBKeyRange
-Retrieving and making changes to your data: IDBObjectStore
-Using cursors: IDBCursor
-Reference example: To-do Notifications (View the example live).