Database.IndexedDB.IDBObjectStore
- Package
- purescript-indexeddb
- Repository
- truqu/purescript-indexedDB
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 store val key e. IDBKey key => IDBObjectStore store => store -> val -> Maybe key -> Aff (idb :: IDB | e) 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 e. IDBObjectStore store => store -> Aff (idb :: IDB | e) Unit
Deletes all records in store.
#createIndex Source
createIndex :: forall store e. IDBObjectStore store => store -> IndexName -> KeyPath -> IndexParameters -> Aff (idb :: IDB | e) 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.
#deleteIndex Source
deleteIndex :: forall store e. IDBObjectStore store => store -> IndexName -> Aff (idb :: IDB | e) Unit
Deletes the index in store with the given name.
Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.
#put Source
put :: forall store key val e. IDBKey key => IDBObjectStore store => store -> val -> Maybe key -> Aff (idb :: IDB | e) 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 e' e. IDBIndex index => index -> Maybe KeyRange -> CursorDirection -> Callbacks KeyCursor e' -> Aff (idb :: IDB | e) 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 e' e. IDBIndex index => index -> Maybe KeyRange -> CursorDirection -> Callbacks ValueCursor e' -> Aff (idb :: IDB | e) 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