Module

Database.IndexedDB.IDBIndex

Package
purescript-indexed-db
Repository
ilyakooo0/purescript-indexed-DB

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 = { onComplete :: Effect Unit, onError :: Error -> Effect Unit, onSuccess :: cursor -> Effect Unit }

Callbacks to manipulate a cursor from an Open*Cursor call

#count Source

count :: forall index. IDBIndex index => index -> Maybe KeyRange -> Aff Int

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

#get Source

get :: forall a index. IDBIndex index => index -> KeyRange -> Aff (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. IDBIndex index => index -> Maybe KeyRange -> Maybe Int -> Aff (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. IDBIndex index => index -> KeyRange -> Aff (Maybe Key)

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

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

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

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