Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

IDBPObjectStore

interface IDBPObjectStore <DBTypes extends DBSchema | unknown = unknown, TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>, StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>, Mode extends IDBTransactionMode = "readonly"> extends IDBPObjectStoreExtends {
add: Mode extends "readonly" ? undefined : (value: StoreValue<DBTypes, StoreName>, key?: StoreKey<DBTypes, StoreName> | IDBKeyRange) => Promise<StoreKey<DBTypes, StoreName>>;
clear: Mode extends "readonly" ? undefined : () => Promise<void>;
createIndex: Mode extends "versionchange" ? <IndexName extends IndexNames<DBTypes, StoreName>>(
name: IndexName,
keyPath: string | string[],
options?: IDBIndexParameters,
) => IDBPIndex<DBTypes, TxStores, StoreName, IndexName, Mode>
: undefined
;
delete: Mode extends "readonly" ? undefined : (key: StoreKey<DBTypes, StoreName> | IDBKeyRange) => Promise<void>;
readonly indexNames: TypedDOMStringList<IndexNames<DBTypes, StoreName>>;
put: Mode extends "readonly" ? undefined : (value: StoreValue<DBTypes, StoreName>, key?: StoreKey<DBTypes, StoreName> | IDBKeyRange) => Promise<StoreKey<DBTypes, StoreName>>;
readonly transaction: IDBPTransaction<DBTypes, TxStores, Mode>;
[[Symbol.asyncIterator]](): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, unknown, Mode>>;
count(key?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null): Promise<number>;
get(query: StoreKey<DBTypes, StoreName> | IDBKeyRange): Promise<StoreValue<DBTypes, StoreName> | undefined>;
getAll(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, count?: number): Promise<StoreValue<DBTypes, StoreName>[]>;
getAllKeys(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, count?: number): Promise<StoreKey<DBTypes, StoreName>[]>;
getKey(query: StoreKey<DBTypes, StoreName> | IDBKeyRange): Promise<StoreKey<DBTypes, StoreName> | undefined>;
index<IndexName extends IndexNames<DBTypes, StoreName>>(name: IndexName): IDBPIndex<DBTypes, TxStores, StoreName, IndexName, Mode>;
iterate(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, direction?: IDBCursorDirection): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, unknown, Mode>>;
openCursor(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, direction?: IDBCursorDirection): Promise<IDBPCursorWithValue<DBTypes, TxStores, StoreName, unknown, Mode> | null>;
openKeyCursor(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, direction?: IDBCursorDirection): Promise<IDBPCursor<DBTypes, TxStores, StoreName, unknown, Mode> | null>;
}

§Type Parameters

§
DBTypes extends DBSchema | unknown = unknown
[src]
§
TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>
[src]
§
StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>
[src]
§
Mode extends IDBTransactionMode = "readonly"
[src]

§Extends

§
IDBPObjectStoreExtends
[src]

§Properties

§
add: Mode extends "readonly" ? undefined : (value: StoreValue<DBTypes, StoreName>, key?: StoreKey<DBTypes, StoreName> | IDBKeyRange) => Promise<StoreKey<DBTypes, StoreName>>
[src]

Add a value to the store.

Rejects if an item of a given key already exists in the store.

§
clear: Mode extends "readonly" ? undefined : () => Promise<void>
[src]

Deletes all records in store.

§
createIndex: Mode extends "versionchange" ? <IndexName extends IndexNames<DBTypes, StoreName>>(
name: IndexName,
keyPath: string | string[],
options?: IDBIndexParameters,
) => IDBPIndex<DBTypes, TxStores, StoreName, IndexName, Mode>
: undefined
[src]

Creates a new index in store.

Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.

§
delete: Mode extends "readonly" ? undefined : (key: StoreKey<DBTypes, StoreName> | IDBKeyRange) => Promise<void>
[src]

Deletes records in store matching the given query.

§
readonly indexNames: TypedDOMStringList<IndexNames<DBTypes, StoreName>>
[src]

The names of indexes in the store.

§
put: Mode extends "readonly" ? undefined : (value: StoreValue<DBTypes, StoreName>, key?: StoreKey<DBTypes, StoreName> | IDBKeyRange) => Promise<StoreKey<DBTypes, StoreName>>
[src]

Put an item in the store.

Replaces any item with the same key.

§
readonly transaction: IDBPTransaction<DBTypes, TxStores, Mode>
[src]

The associated transaction.

§Methods

§
[[Symbol.asyncIterator]](): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, unknown, Mode>>
[src]

Iterate over the store.

§
count(key?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null): Promise<number>
[src]

Retrieves the number of records matching the given query.

§
get(query: StoreKey<DBTypes, StoreName> | IDBKeyRange): Promise<StoreValue<DBTypes, StoreName> | undefined>
[src]

Retrieves the value of the first record matching the query.

Resolves with undefined if no match is found.

§
getAll(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, count?: number): Promise<StoreValue<DBTypes, StoreName>[]>
[src]

Retrieves all values that match the query.

@param query
@param count

Maximum number of values to return.

§
getAllKeys(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, count?: number): Promise<StoreKey<DBTypes, StoreName>[]>
[src]

Retrieves the keys of records matching the query.

@param query
@param count

Maximum number of keys to return.

§
getKey(query: StoreKey<DBTypes, StoreName> | IDBKeyRange): Promise<StoreKey<DBTypes, StoreName> | undefined>
[src]

Retrieves the key of the first record that matches the query.

Resolves with undefined if no match is found.

§
index<IndexName extends IndexNames<DBTypes, StoreName>>(name: IndexName): IDBPIndex<DBTypes, TxStores, StoreName, IndexName, Mode>
[src]

Get a query of a given name.

§
iterate(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, direction?: IDBCursorDirection): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, unknown, Mode>>
[src]

Iterate over the records matching the query.

@param query

If null, all records match.

@param direction
§
openCursor(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, direction?: IDBCursorDirection): Promise<IDBPCursorWithValue<DBTypes, TxStores, StoreName, unknown, Mode> | null>
[src]

Opens a cursor over the records matching the query.

Resolves with null if no matches are found.

@param query

If null, all records match.

@param direction
§
openKeyCursor(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, direction?: IDBCursorDirection): Promise<IDBPCursor<DBTypes, TxStores, StoreName, unknown, Mode> | null>
[src]

Opens a cursor over the keys matching the query.

Resolves with null if no matches are found.

@param query

If null, all records match.

@param direction