Module

Database.IndexedDB.IDBIndex

Package
purescript-indexeddb
Repository
truqu/purescript-indexedDB

An index allows looking up records in an object store using properties of the values in the object stores records.

#Callbacks Source

type Callbacks cursor e = { onComplete :: Eff e Unit, onError :: Error -> Eff e Unit, onSuccess :: cursor -> Eff e Unit }

Callbacks to manipulate a cursor from an Open*Cursor call

#count Source

count :: forall index e. IDBIndex index => index -> Maybe KeyRange -> Aff (idb :: IDB | e) Int

Retrieves the number of records matching the key range in query.

#get Source

get :: forall index e a. IDBIndex index => index -> KeyRange -> Aff (idb :: IDB | e) (Maybe a)

Retrieves the value of the first record matching the given key range in query.

NOTE The coercion from a to any type is unsafe and might throw a runtime error if incorrect.

#getAllKeys Source

getAllKeys :: forall index e. IDBIndex index => index -> Maybe KeyRange -> Maybe Int -> Aff (idb :: IDB | e) (Array Key)

Retrieves the keys of records matching the given key range in query (up to the number given if given).

#getKey Source

getKey :: forall index e. IDBIndex index => index -> KeyRange -> Aff (idb :: IDB | e) (Maybe Key)

Retrieves the key of the first record matching the given key or key range in query.

#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.

#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.

#keyPath Source

keyPath :: Index -> KeyPath

Returns the key path of the index.

#multiEntry Source

multiEntry :: Index -> Boolean

Returns true if the index's multiEntry flag is set.

#name Source

name :: Index -> String

Returns the name of the index.

#objectStore Source

objectStore :: Index -> ObjectStore

Returns the IDBObjectStore the index belongs to.

#unique Source

unique :: Index -> Boolean

Returns true if the index's unique flag is set.