From 9197f3697d9645fc8a7b3eaad78d020c086e3983 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Fri, 7 Jul 2017 11:39:29 +0200 Subject: [PATCH] change class method indentations --- src/Database/IndexedDB/IDBDatabase.purs | 26 +++++++++++-- src/Database/IndexedDB/IDBObjectStore.purs | 45 ++++++++++++++++++---- src/Database/IndexedDB/IDBTransaction.purs | 15 ++++++-- 3 files changed, 71 insertions(+), 15 deletions(-) diff --git a/src/Database/IndexedDB/IDBDatabase.purs b/src/Database/IndexedDB/IDBDatabase.purs index a9697bb..738cf52 100644 --- a/src/Database/IndexedDB/IDBDatabase.purs +++ b/src/Database/IndexedDB/IDBDatabase.purs @@ -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 diff --git a/src/Database/IndexedDB/IDBObjectStore.purs b/src/Database/IndexedDB/IDBObjectStore.purs index fa89094..3e912a0 100644 --- a/src/Database/IndexedDB/IDBObjectStore.purs +++ b/src/Database/IndexedDB/IDBObjectStore.purs @@ -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 diff --git a/src/Database/IndexedDB/IDBTransaction.purs b/src/Database/IndexedDB/IDBTransaction.purs index e5ecabf..5f3f6df 100644 --- a/src/Database/IndexedDB/IDBTransaction.purs +++ b/src/Database/IndexedDB/IDBTransaction.purs @@ -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 --------------------