mirror of
https://github.com/ilyakooo0/purescript-indexedDB.git
synced 2024-09-11 06:55:48 +03:00
change class method indentations
This commit is contained in:
parent
5f9f3413c5
commit
9197f3697d
@ -30,23 +30,41 @@ import Database.IndexedDB.IDBObjectStore (IDBObjectStoreParameters)
|
||||
-- | The IDBDatabase interface represents a connection to a database.
|
||||
class IDBDatabase db where
|
||||
-- | Closes the connection once all running transactions have finished.
|
||||
close :: forall e. db -> Aff (idb :: IDB | e) Unit
|
||||
close
|
||||
:: forall e
|
||||
. db
|
||||
-> Aff (idb :: IDB | e) Unit
|
||||
|
||||
-- | 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
|
||||
createObjectStore :: forall e. db -> StoreName -> IDBObjectStoreParameters -> Aff (idb :: IDB | e) ObjectStore
|
||||
createObjectStore
|
||||
:: forall e
|
||||
. db
|
||||
-> StoreName
|
||||
-> IDBObjectStoreParameters
|
||||
-> Aff (idb :: IDB | e) ObjectStore
|
||||
|
||||
-- | Deletes the object store with the given name.
|
||||
-- |
|
||||
-- | Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.
|
||||
deleteObjectStore :: forall e. db -> StoreName -> Aff (idb :: IDB | e) ObjectStore
|
||||
deleteObjectStore
|
||||
:: forall e
|
||||
. db
|
||||
-> StoreName
|
||||
-> Aff (idb :: IDB | e) ObjectStore
|
||||
|
||||
-- | Returns a new transaction with the given mode (ReadOnly|ReadWrite)
|
||||
-- | and scope which in the form of an array of object store names.
|
||||
transaction :: forall e. db -> Array StoreName -> TransactionMode -> Aff (idb :: IDB | e) Transaction
|
||||
transaction
|
||||
:: forall e
|
||||
. db
|
||||
-> Array StoreName
|
||||
-> TransactionMode
|
||||
-> Aff (idb :: IDB | e) Transaction
|
||||
|
||||
|
||||
-- | Type alias for StoreName
|
||||
type StoreName = String
|
||||
|
||||
|
||||
|
@ -38,10 +38,18 @@ class IDBObjectStore store where
|
||||
-- |
|
||||
-- | If add() is used, and if a record with the key already exists the request will fail,
|
||||
-- | with a "ConstraintError" DOMException.
|
||||
add :: forall v k e. (IDBKey k) => store -> v -> Maybe k -> Aff (idb :: IDB | e) Key
|
||||
add
|
||||
:: forall v k e. (IDBKey k)
|
||||
=> store
|
||||
-> v
|
||||
-> Maybe k
|
||||
-> Aff (idb :: IDB | e) Key
|
||||
|
||||
-- | Deletes all records in store.
|
||||
clear :: forall e. store -> Aff (idb :: IDB | e) Unit
|
||||
clear
|
||||
:: forall e
|
||||
. store
|
||||
-> Aff (idb :: IDB | e) Unit
|
||||
|
||||
-- | 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
|
||||
@ -49,18 +57,36 @@ class IDBObjectStore store where
|
||||
-- | will abort with a "ConstraintError" DOMException.
|
||||
-- |
|
||||
-- | Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.
|
||||
createIndex :: forall e. store -> IndexName -> KeyPath -> IDBIndexParameters -> Aff (idb :: IDB | e) Index
|
||||
createIndex
|
||||
:: forall e
|
||||
. store
|
||||
-> IndexName
|
||||
-> KeyPath
|
||||
-> IDBIndexParameters
|
||||
-> Aff (idb :: IDB | e) Index
|
||||
|
||||
-- | Deletes records in store with the given key or in the given key range in query.
|
||||
delete :: forall e. store -> KeyRange -> Aff (idb :: IDB | e) Unit
|
||||
delete
|
||||
:: forall e
|
||||
. store
|
||||
-> KeyRange
|
||||
-> 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.
|
||||
deleteIndex :: forall e. store -> IndexName -> Aff (idb :: IDB | e) Unit
|
||||
deleteIndex
|
||||
:: forall e
|
||||
. store
|
||||
-> IndexName
|
||||
-> Aff (idb :: IDB | e) Unit
|
||||
|
||||
-- | Returns an IDBIndex for the index named name in store.
|
||||
index :: forall e. store -> IndexName -> Aff (idb :: IDB | e) Index
|
||||
index
|
||||
:: forall e
|
||||
. store
|
||||
-> IndexName
|
||||
-> Aff (idb :: IDB | e) Index
|
||||
|
||||
-- | Adds or updates a record in store with the given value and key.
|
||||
-- |
|
||||
@ -68,7 +94,12 @@ class IDBObjectStore store where
|
||||
-- | will be thrown.
|
||||
-- |
|
||||
-- | If put() is used, any existing record with the key will be replaced.
|
||||
put :: forall v k e. (IDBKey k) => store -> v -> Maybe k -> Aff (idb :: IDB | e) Key
|
||||
put
|
||||
:: forall v k e. (IDBKey k)
|
||||
=> store
|
||||
-> v
|
||||
-> Maybe k
|
||||
-> Aff (idb :: IDB | e) Key
|
||||
|
||||
|
||||
-- | Type alias for IndexName
|
||||
|
@ -29,10 +29,17 @@ import Database.IndexedDB.Core (IDB, Database, ObjectStore, Transaction, Tra
|
||||
class IDBTransaction tx where
|
||||
-- | Aborts the transaction. All pending requests will fail with a "AbortError"
|
||||
-- | DOMException and all changes made to the database will be reverted.
|
||||
abort :: forall e. tx -> Aff (idb :: IDB | e) Unit
|
||||
abort
|
||||
:: forall e
|
||||
. tx
|
||||
-> Aff (idb :: IDB | e) Unit
|
||||
|
||||
-- | Returns an IDBObjectStore in the transaction's scope.
|
||||
objectStore :: forall e. tx -> String -> Aff (idb :: IDB | e) ObjectStore
|
||||
objectStore
|
||||
:: forall e
|
||||
. tx
|
||||
-> String
|
||||
-> Aff (idb :: IDB | e) ObjectStore
|
||||
|
||||
|
||||
--------------------
|
||||
@ -99,8 +106,8 @@ onError
|
||||
. Transaction
|
||||
-> (Error -> Eff ( | e') Unit)
|
||||
-> Aff (idb :: IDB | e) Unit
|
||||
onError db f =
|
||||
Fn.runFn2 _onError db f
|
||||
onError db' f =
|
||||
Fn.runFn2 _onError db' f
|
||||
|
||||
|
||||
--------------------
|
||||
|
Loading…
Reference in New Issue
Block a user