IDBIndex

open class IDBIndex(source)

IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data.

MDN Reference

Properties

Link copied to clipboard
open external val keyPath: JsAny

The keyPath read-only property of the IDBIndex interface returns the key path of the current index. If null, this index is not auto-populated.

Link copied to clipboard
open external val multiEntry: Boolean

The multiEntry read-only property of the IDBIndex interface returns a boolean value that affects how the index behaves when the result of evaluating the index's key path yields an array.

Link copied to clipboard
open external var name: String

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

Link copied to clipboard
open external val objectStore: IDBObjectStore

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

Link copied to clipboard
open external val unique: Boolean

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

Functions

Link copied to clipboard
open external fun count(query: IDBKeyRange): IDBRequest<JsInt>
open external 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
open external fun get(query: IDBKeyRange): IDBRequest<*>
open external 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 IDBKeyRange.

Link copied to clipboard
open external fun getAll(queryOrOptions: IDBKeyRange?, count: Int = definedExternally): IDBRequest<ReadonlyArray<*>>
open external fun getAll(queryOrOptions: 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
open external fun getAllKeys(queryOrOptions: IDBKeyRange?, count: Int = definedExternally): IDBRequest<ReadonlyArray<IDBValidKey>>
open external fun getAllKeys(queryOrOptions: 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
open external fun getAllRecords(options: IDBGetAllOptions = definedExternally): IDBRequest<*>

The getAllRecords() method of the IDBIndex interface retrieves all records (including index keys, primary keys, and values) from the index.

Link copied to clipboard
open external fun getKey(query: IDBKeyRange): IDBRequest<IDBValidKey?>
open external fun getKey(query: IDBValidKey): IDBRequest<IDBValidKey?>

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 IDBKeyRange.

Link copied to clipboard
open external fun openCursor(query: IDBKeyRange?, direction: IDBCursorDirection = definedExternally): IDBRequest<IDBCursorWithValue?>
open external 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
open external fun openKeyCursor(query: IDBKeyRange?, direction: IDBCursorDirection = definedExternally): IDBRequest<IDBCursor?>
open external fun openKeyCursor(query: IDBValidKey? = definedExternally, direction: IDBCursorDirection = definedExternally): IDBRequest<IDBCursor?>

The openKeyCursor() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range, as arranged by this index.