IDBObjectStore
Values
add
Adds or updates a record in store with the given value and key.
If the store uses in-line keys and key is specified a "DataError" DOMException will be thrown.
If put() is used, any existing record with the key will be replaced. If add() is used, and if a record with the key already exists the request will fail, with request's error set to a "ConstraintError" DOMException.
If successful, request's result will be the record's key. Read more on MDN
let add: ( IndexedDbTypes.idbObjectStore, ~value: JSON.t, ~key: IndexedDbTypes.idbValidKey=?,) => IndexedDbTypes.idbRequest<IndexedDbTypes.idbValidKey>Parameters
IndexedDbTypes.idbObjectStore Stdlib.JSON.t option< IndexedDbTypes.idbValidKey >Return type
IndexedDbTypes.idbRequest< IndexedDbTypes.idbValidKey >clear
Deletes all records in store.
If successful, request's result will be undefined. Read more on MDN
let clear: IndexedDbTypes.idbObjectStore => IndexedDbTypes.idbRequest< unit,>Parameters
IndexedDbTypes.idbObjectStoreReturn type
IndexedDbTypes.idbRequest< unit >count
Retrieves the number of records matching the given key or key range in query.
If successful, request's result will be the count. Read more on MDN
let count: ( IndexedDbTypes.idbObjectStore, ~query: unknown=?,) => IndexedDbTypes.idbRequest<int>Parameters
IndexedDbTypes.idbObjectStore option< unknown >Return type
IndexedDbTypes.idbRequest< int >createIndex
Creates a new index in store with the given name, keyPath and options and returns a new IDBIndex. If the keyPath and options define constraints that cannot be satisfied with the data already in store the upgrade transaction will abort with a "ConstraintError" DOMException.
Throws an "InvalidStateError" DOMException if not called within an upgrade transaction. Read more on MDN
let createIndex: ( IndexedDbTypes.idbObjectStore, ~name: string, ~keyPath: string, ~options: IndexedDbTypes.idbIndexParameters=?,) => IndexedDbTypes.idbIndexParameters
IndexedDbTypes.idbObjectStore string string option< IndexedDbTypes.idbIndexParameters >Return type
IndexedDbTypes.idbIndexcreateIndex2
Creates a new index in store with the given name, keyPath and options and returns a new IDBIndex. If the keyPath and options define constraints that cannot be satisfied with the data already in store the upgrade transaction will abort with a "ConstraintError" DOMException.
Throws an "InvalidStateError" DOMException if not called within an upgrade transaction. Read more on MDN
let createIndex2: ( IndexedDbTypes.idbObjectStore, ~name: string, ~keyPath: array<string>, ~options: IndexedDbTypes.idbIndexParameters=?,) => IndexedDbTypes.idbIndexParameters
IndexedDbTypes.idbObjectStore string array< string > option< IndexedDbTypes.idbIndexParameters >Return type
IndexedDbTypes.idbIndexdelete
Deletes records in store with the given key or in the given key range in query.
If successful, request's result will be undefined. Read more on MDN
let delete: ( IndexedDbTypes.idbObjectStore, unknown,) => IndexedDbTypes.idbRequest<unit>Parameters
IndexedDbTypes.idbObjectStore unknownReturn type
IndexedDbTypes.idbRequest< unit >deleteIndex
Deletes the index in store with the given name.
Throws an "InvalidStateError" DOMException if not called within an upgrade transaction. Read more on MDN
let deleteIndex: (IndexedDbTypes.idbObjectStore, string) => unitParameters
IndexedDbTypes.idbObjectStore stringReturn type
unitget
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. Read more on MDN
let get: ( IndexedDbTypes.idbObjectStore, unknown,) => IndexedDbTypes.idbRequest<JSON.t>Parameters
IndexedDbTypes.idbObjectStore unknownReturn type
IndexedDbTypes.idbRequest< Stdlib.JSON.t >getAll
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. Read more on MDN
let getAll: ( IndexedDbTypes.idbObjectStore, ~query: unknown=?, ~count: int=?,) => IndexedDbTypes.idbRequest<array<JSON.t>>Parameters
IndexedDbTypes.idbObjectStore option< unknown > option< int >Return type
IndexedDbTypes.idbRequest< array< Stdlib.JSON.t > >getAllKeys
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. Read more on MDN
let getAllKeys: ( IndexedDbTypes.idbObjectStore, ~query: unknown=?, ~count: int=?,) => IndexedDbTypes.idbRequest< array<IndexedDbTypes.idbValidKey>,>Parameters
IndexedDbTypes.idbObjectStore option< unknown > option< int >Return type
IndexedDbTypes.idbRequest< array< IndexedDbTypes.idbValidKey > >getKey
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. Read more on MDN
let getKey: ( IndexedDbTypes.idbObjectStore, unknown,) => IndexedDbTypes.idbRequest<unknown>Parameters
IndexedDbTypes.idbObjectStore unknownReturn type
IndexedDbTypes.idbRequest< unknown >index
let index: ( IndexedDbTypes.idbObjectStore, string,) => IndexedDbTypes.idbIndexParameters
IndexedDbTypes.idbObjectStore stringReturn type
IndexedDbTypes.idbIndexopenCursor
Opens a cursor over the records matching query, ordered by direction. If query is null, all records in store are matched.
If successful, request's result will be an IDBCursorWithValue pointing at the first matching record, or null if there were no matching records. Read more on MDN
let openCursor: ( IndexedDbTypes.idbObjectStore, ~query: unknown=?, ~direction: IndexedDbTypes.idbCursorDirection=?,) => IndexedDbTypes.idbRequest<unknown>Parameters
IndexedDbTypes.idbObjectStore option< unknown > option< IndexedDbTypes.idbCursorDirection >Return type
IndexedDbTypes.idbRequest< unknown >openKeyCursor
Opens a cursor with key only flag set over the records matching query, ordered by direction. If query is null, all records in store are matched.
If successful, request's result will be an IDBCursor pointing at the first matching record, or null if there were no matching records. Read more on MDN
let openKeyCursor: ( IndexedDbTypes.idbObjectStore, ~query: unknown=?, ~direction: IndexedDbTypes.idbCursorDirection=?,) => IndexedDbTypes.idbRequest<unknown>Parameters
IndexedDbTypes.idbObjectStore option< unknown > option< IndexedDbTypes.idbCursorDirection >Return type
IndexedDbTypes.idbRequest< unknown >put
Adds or updates a record in store with the given value and key.
If the store uses in-line keys and key is specified a "DataError" DOMException will be thrown.
If put() is used, any existing record with the key will be replaced. If add() is used, and if a record with the key already exists the request will fail, with request's error set to a "ConstraintError" DOMException.
If successful, request's result will be the record's key. Read more on MDN
let put: ( IndexedDbTypes.idbObjectStore, ~value: JSON.t, ~key: IndexedDbTypes.idbValidKey=?,) => IndexedDbTypes.idbRequest<IndexedDbTypes.idbValidKey>