Database.IndexedDB.IDBObjectStore
- Package
- purescript-indexed-db
- Repository
- ilyakooo0/purescript-indexed-DB
An object store is the primary storage mechanism for storing data in a database.
#IndexParameters Source
type IndexParameters = { multiEntry :: Boolean, unique :: Boolean }
Flags to set on the index.
An index has a unique
flag. When this flag is set, the index enforces that no
two records in the index has the same key. If a record in the index’s referenced
object store is attempted to be inserted or modified such that evaluating the index’s
key path on the records new value yields a result which already exists in the index,
then the attempted modification to the object store fails.
An index has a multiEntry
flag. This flag affects how the index behaves when the
result of evaluating the index’s key path yields an array key. If the multiEntry
flag
is unset, then a single record whose key is an array key is added to the index.
If the multiEntry
flag is true, then the one record is added to the index for each
of the subkeys.
#add Source
add :: forall key val store. IDBKey key => IDBObjectStore store => store -> val -> Maybe key -> Aff Key
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 add() is used, and if a record with the key already exists the request will fail, with a "ConstraintError" DOMException.
#clear Source
clear :: forall store. IDBObjectStore store => store -> Aff Unit
Deletes all records in store.
#createIndex Source
createIndex :: forall store. IDBObjectStore store => store -> IndexName -> KeyPath -> IndexParameters -> Aff Index
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.
#delete Source
delete :: forall store. IDBObjectStore store => store -> KeyRange -> Aff Unit
Deletes records in store with the given key or in the given key range in query.
#deleteIndex Source
deleteIndex :: forall store. IDBObjectStore store => store -> IndexName -> Aff Unit
Deletes the index in store with the given name.
Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.
#index Source
index :: forall store. IDBObjectStore store => store -> IndexName -> Aff Index
Returns an IDBIndex for the index named name in store.
#put Source
put :: forall val key store. IDBKey key => IDBObjectStore store => store -> val -> Maybe key -> Aff Key
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.
#autoIncrement Source
autoIncrement :: ObjectStore -> Boolean
Returns true
if the store has a key generator, and false
otherwise.
#indexNames Source
indexNames :: ObjectStore -> Array String
Returns a list of the names of indexes in the store.
#keyPath Source
keyPath :: ObjectStore -> Array String
Returns the key path of the store, or empty array if none
#name Source
name :: ObjectStore -> String
Returns the name of the store.
#transaction Source
transaction :: ObjectStore -> Transaction
Returns the associated transaction.
Re-exports from Database.IndexedDB.IDBIndex
#openKeyCursor Source
openKeyCursor :: forall index. IDBIndex index => index -> Maybe KeyRange -> CursorDirection -> Callbacks KeyCursor -> Aff Unit
Opens a KeyCursor over the records matching query, ordered by direction.
If query is Nothing
, all records in index are matched.
#openCursor Source
openCursor :: forall index. IDBIndex index => index -> Maybe KeyRange -> CursorDirection -> Callbacks ValueCursor -> Aff Unit
Opens a ValueCursor over the records matching query, ordered by direction.
If query is Nothing
, all records in index are matched.
- Modules
- Database.
IndexedDB. Core - Database.
IndexedDB. IDBCursor - Database.
IndexedDB. IDBDatabase - Database.
IndexedDB. IDBFactory - Database.
IndexedDB. IDBIndex - Database.
IndexedDB. IDBKey - Database.
IndexedDB. IDBKey. Internal - Database.
IndexedDB. IDBKeyRange - Database.
IndexedDB. IDBObjectStore - Database.
IndexedDB. IDBTransaction