Interface IDBIndex
keyPath: string | string[];
multiEntry: boolean;
name: string;
objectStore: IDBObjectStore;
unique: boolean;
count(query?: IDBValidKey | IDBKeyRange): IDBRequest<number>;
get(query: IDBValidKey | IDBKeyRange): IDBRequest<any>;
getAll(query?: IDBValidKey | IDBKeyRange, count?: number): IDBRequest<any[]>;
getAllKeys(query?: IDBValidKey | IDBKeyRange, count?: number): IDBRequest<IDBValidKey[]>;
getKey(query: IDBValidKey | IDBKeyRange): IDBRequest<IDBValidKey>;
openCursor(query?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest<IDBCursorWithValue>;
openKeyCursor(query?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest<IDBCursor>;
}
Index
Properties
Methods
Properties
Readonly
keyPath
Readonly
multiEntry
name
Returns the name of the index.
Readonly
objectStore
Returns the IDBObjectStore the index belongs to.
Readonly
unique
Methods
count
- count(query?): IDBRequest<number>
Retrieves the number of records matching the given key or key range in query.
If successful, request's result will be the count.
Parameters
Optional
query: IDBValidKey | IDBKeyRange
Returns IDBRequest<number>
get
- get(query): IDBRequest<any>
Retrieves the value of the first record matching the given key or key range in query.
If successful, request's result will be the value, or undefined if there was no matching record.
Parameters
- query: IDBValidKey | IDBKeyRange
Returns IDBRequest<any>
getAll
- get
All (query?, count?): IDBRequest<any[]> Retrieves the values of the records matching the given key or key range in query (up to count if given).
If successful, request's result will be an Array of the values.
Parameters
Optional
query: IDBValidKey | IDBKeyRangeOptional
count: number
Returns IDBRequest<any[]>
getAllKeys
- get
All (query?, count?): IDBRequest<IDBValidKey[]>Keys Retrieves the keys of records matching the given key or key range in query (up to count if given).
If successful, request's result will be an Array of the keys.
Parameters
Optional
query: IDBValidKey | IDBKeyRangeOptional
count: number
Returns IDBRequest<IDBValidKey[]>
getKey
- get
Key (query): IDBRequest<IDBValidKey> Retrieves the key of the first record matching the given key or key range in query.
If successful, request's result will be the key, or undefined if there was no matching record.
Parameters
- query: IDBValidKey | IDBKeyRange
Returns IDBRequest<IDBValidKey>
openCursor
- open
Cursor (query?, direction?): IDBRequest<IDBCursorWithValue> Opens a cursor over the records matching query, ordered by direction. If query is null, all records in index are matched.
If successful, request's result will be an IDBCursorWithValue, or null if there were no matching records.
Parameters
Optional
query: IDBValidKey | IDBKeyRangeOptional
direction: IDBCursorDirection
Returns IDBRequest<IDBCursorWithValue>
openKeyCursor
- open
Key (query?, direction?): IDBRequest<IDBCursor>Cursor Opens a cursor with key only flag set over the records matching query, ordered by direction. If query is null, all records in index are matched.
If successful, request's result will be an IDBCursor, or null if there were no matching records.
Parameters
Optional
query: IDBValidKey | IDBKeyRangeOptional
direction: IDBCursorDirection
Returns IDBRequest<IDBCursor>
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