IDBIndex

IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database.

MDN Reference

Properties

Link copied to clipboard

The keyPath property of the IDBIndex interface returns the key path of the current index.

Link copied to clipboard

The multiEntry read-only property of the behaves when the result of evaluating the index's key path yields an array.

Link copied to clipboard

The name property of the IDBIndex interface contains a string which names the index.

Link copied to clipboard

The objectStore property of the IDBIndex interface returns the object store referenced by the current index.

Link copied to clipboard

The unique read-only property returns a boolean that states whether the index allows duplicate keys.

Functions

Link copied to clipboard

fun count(query: IDBValidKey = definedExternally): IDBRequest<JsInt>

The count() method of the IDBIndex interface returns an IDBRequest object, and in a separate thread, returns the number of records within a key range.

Link copied to clipboard
fun get(query: IDBKeyRange): IDBRequest<*>

fun get(query: IDBValidKey): IDBRequest<*>

The get() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, finds either the value in the referenced object store that corresponds to the given key or the first corresponding value, if key is set to an If a value is found, then a structured clone of it is created and set as the result of the request object: this returns the record the key is associated with.

Link copied to clipboard
fun getAll(query: IDBKeyRange?, count: Int = definedExternally): IDBRequest<ReadonlyArray<*>>

fun getAll(query: IDBValidKey? = definedExternally, count: Int = definedExternally): IDBRequest<ReadonlyArray<*>>

The getAll() method of the IDBIndex interface retrieves all objects that are inside the index.

Link copied to clipboard
fun getAllKeys(query: IDBKeyRange?, count: Int = definedExternally): IDBRequest<ReadonlyArray<IDBValidKey>>

fun getAllKeys(query: IDBValidKey? = definedExternally, count: Int = definedExternally): IDBRequest<ReadonlyArray<IDBValidKey>>

The getAllKeys() method of the IDBIndex interface asynchronously retrieves the primary keys of all objects inside the index, setting them as the result of the request object.

Link copied to clipboard

The getKey() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, finds either the primary key that corresponds to the given key in this index or the first corresponding primary key, if key is set to an If a primary key is found, it is set as the result of the request object.

Link copied to clipboard
fun openCursor(query: IDBKeyRange?, direction: IDBCursorDirection = definedExternally): IDBRequest<IDBCursorWithValue?>

fun openCursor(query: IDBValidKey? = definedExternally, direction: IDBCursorDirection = definedExternally): IDBRequest<IDBCursorWithValue?>

The openCursor() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range.

Link copied to clipboard
fun openKeyCursor(query: IDBKeyRange?, direction: IDBCursorDirection = definedExternally): IDBRequest<IDBCursor?>

fun openKeyCursor(query: IDBValidKey? = definedExternally, direction: IDBCursorDirection = definedExternally): IDBRequest<IDBCursor?>

The openKeyCursor() method of the a separate thread, creates a cursor over the specified key range, as arranged by this index.