Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/evt/lib/index.ts>dom.IDBIndex

💧EventEmitter's typesafe replacement
Go to Latest
interface dom.IDBIndex
import { type dom } from "https://deno.land/x/evt@v2.4.7/lib/index.ts";
const { IDBIndex } = dom;

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.

Properties

readonly
keyPath: string | string[]
readonly
multiEntry: boolean
name: string

Returns the name of the index.

readonly
objectStore: IDBObjectStore

Returns the IDBObjectStore the index belongs to.

readonly
unique: boolean

Methods

count(key?: IDBValidKey | IDBKeyRange): 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.

get(key: IDBValidKey | IDBKeyRange): IDBRequest<any | undefined>

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.

getAll(query?: IDBValidKey | IDBKeyRange | null, count?: number): 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.

getAllKeys(query?: IDBValidKey | IDBKeyRange | null, count?: number): IDBRequest<IDBValidKey[]>

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.

getKey(key: IDBValidKey | IDBKeyRange): IDBRequest<IDBValidKey | undefined>

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.

openCursor(query?: IDBValidKey | IDBKeyRange | null, direction?: IDBCursorDirection): IDBRequest<IDBCursorWithValue | null>

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.

openKeyCursor(query?: IDBValidKey | IDBKeyRange | null, direction?: IDBCursorDirection): IDBRequest<IDBCursor | null>

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.