Module

Database.IndexedDB.IDBDatabase

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

Each origin has an associated set of databases. A database has zero or more object stores which hold the data stored in the database.

#StoreName Source

type StoreName = String

Type alias for StoreName

#ObjectStoreParameters Source

type ObjectStoreParameters = { autoIncrement :: Boolean, keyPath :: KeyPath }

Options provided when creating an object store.

#close Source

close :: forall db. IDBDatabase db => db -> Aff Unit

Closes the connection once all running transactions have finished.

#createObjectStore Source

createObjectStore :: forall db. IDBDatabase db => db -> StoreName -> ObjectStoreParameters -> Aff ObjectStore

Creates a new object store with the given name and options and returns a new IDBObjectStore.

Throws a "InvalidStateError" DOMException if not called within an upgrade transaction

#deleteObjectStore Source

deleteObjectStore :: forall db. IDBDatabase db => db -> StoreName -> Aff ObjectStore

Deletes the object store with the given name.

Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.

#transaction Source

transaction :: forall db. IDBDatabase db => db -> Array StoreName -> TransactionMode -> Aff Transaction

Returns a new transaction with the given mode (ReadOnly|ReadWrite) and scope which in the form of an array of object store names.

#name Source

name :: Database -> String

Returns the name of the database.

#objectStoreNames Source

objectStoreNames :: Database -> Array String

Returns a list of the names of object stores in the database.

#version Source

version :: Database -> Int

Returns the version of the database.

#onAbort Source

onAbort :: Database -> Effect Unit -> Aff Unit

Event handler for the abort event.

#onClose Source

onClose :: Database -> Effect Unit -> Aff Unit

Event handler for the close event.

#onError Source

onError :: Database -> (Error -> Effect Unit) -> Aff Unit

Event handler for the error event.

#onVersionChange Source

onVersionChange :: Database -> ({ newVersion :: Int, oldVersion :: Int } -> Effect Unit) -> Aff Unit

Event handler for the versionchange event.