{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.IDBIndex
(openCursorRange, openCursorRange_, openCursor, openCursor_,
openKeyCursorRange, openKeyCursorRange_, openKeyCursor,
openKeyCursor_, getRange, getRange_, get, get_, getKeyRange,
getKeyRange_, getKey, getKey_, getAllRange, getAllRange_, getAll,
getAll_, getAllKeysRange, getAllKeysRange_, getAllKeys,
getAllKeys_, countRange, countRange_, count, count_, setName,
getName, getObjectStore, getKeyPath, getKeyPathUnsafe,
getKeyPathUnchecked, getMultiEntry, getUnique, IDBIndex(..),
gTypeIDBIndex)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums
openCursorRange ::
(MonadDOM m) =>
IDBIndex ->
Maybe IDBKeyRange -> Maybe IDBCursorDirection -> m IDBRequest
openCursorRange self range direction
= liftDOM
((self ^. jsf "openCursor" [toJSVal range, toJSVal direction]) >>=
fromJSValUnchecked)
openCursorRange_ ::
(MonadDOM m) =>
IDBIndex -> Maybe IDBKeyRange -> Maybe IDBCursorDirection -> m ()
openCursorRange_ self range direction
= liftDOM
(void
(self ^. jsf "openCursor" [toJSVal range, toJSVal direction]))
openCursor ::
(MonadDOM m, ToJSVal key) =>
IDBIndex -> key -> Maybe IDBCursorDirection -> m IDBRequest
openCursor self key direction
= liftDOM
((self ^. jsf "openCursor" [toJSVal key, toJSVal direction]) >>=
fromJSValUnchecked)
openCursor_ ::
(MonadDOM m, ToJSVal key) =>
IDBIndex -> key -> Maybe IDBCursorDirection -> m ()
openCursor_ self key direction
= liftDOM
(void (self ^. jsf "openCursor" [toJSVal key, toJSVal direction]))
openKeyCursorRange ::
(MonadDOM m) =>
IDBIndex ->
Maybe IDBKeyRange -> Maybe IDBCursorDirection -> m IDBRequest
openKeyCursorRange self range direction
= liftDOM
((self ^. jsf "openKeyCursor" [toJSVal range, toJSVal direction])
>>= fromJSValUnchecked)
openKeyCursorRange_ ::
(MonadDOM m) =>
IDBIndex -> Maybe IDBKeyRange -> Maybe IDBCursorDirection -> m ()
openKeyCursorRange_ self range direction
= liftDOM
(void
(self ^. jsf "openKeyCursor" [toJSVal range, toJSVal direction]))
openKeyCursor ::
(MonadDOM m, ToJSVal key) =>
IDBIndex -> key -> Maybe IDBCursorDirection -> m IDBRequest
openKeyCursor self key direction
= liftDOM
((self ^. jsf "openKeyCursor" [toJSVal key, toJSVal direction]) >>=
fromJSValUnchecked)
openKeyCursor_ ::
(MonadDOM m, ToJSVal key) =>
IDBIndex -> key -> Maybe IDBCursorDirection -> m ()
openKeyCursor_ self key direction
= liftDOM
(void
(self ^. jsf "openKeyCursor" [toJSVal key, toJSVal direction]))
getRange ::
(MonadDOM m) => IDBIndex -> Maybe IDBKeyRange -> m IDBRequest
getRange self key
= liftDOM
((self ^. jsf "get" [toJSVal key]) >>= fromJSValUnchecked)
getRange_ :: (MonadDOM m) => IDBIndex -> Maybe IDBKeyRange -> m ()
getRange_ self key
= liftDOM (void (self ^. jsf "get" [toJSVal key]))
get :: (MonadDOM m, ToJSVal key) => IDBIndex -> key -> m IDBRequest
get self key
= liftDOM
((self ^. jsf "get" [toJSVal key]) >>= fromJSValUnchecked)
get_ :: (MonadDOM m, ToJSVal key) => IDBIndex -> key -> m ()
get_ self key = liftDOM (void (self ^. jsf "get" [toJSVal key]))
getKeyRange ::
(MonadDOM m) => IDBIndex -> Maybe IDBKeyRange -> m IDBRequest
getKeyRange self key
= liftDOM
((self ^. jsf "getKey" [toJSVal key]) >>= fromJSValUnchecked)
getKeyRange_ ::
(MonadDOM m) => IDBIndex -> Maybe IDBKeyRange -> m ()
getKeyRange_ self key
= liftDOM (void (self ^. jsf "getKey" [toJSVal key]))
getKey ::
(MonadDOM m, ToJSVal key) => IDBIndex -> key -> m IDBRequest
getKey self key
= liftDOM
((self ^. jsf "getKey" [toJSVal key]) >>= fromJSValUnchecked)
getKey_ :: (MonadDOM m, ToJSVal key) => IDBIndex -> key -> m ()
getKey_ self key
= liftDOM (void (self ^. jsf "getKey" [toJSVal key]))
getAllRange ::
(MonadDOM m) =>
IDBIndex -> Maybe IDBKeyRange -> Maybe Word -> m IDBRequest
getAllRange self range count
= liftDOM
((self ^. jsf "getAll" [toJSVal range, toJSVal count]) >>=
fromJSValUnchecked)
getAllRange_ ::
(MonadDOM m) => IDBIndex -> Maybe IDBKeyRange -> Maybe Word -> m ()
getAllRange_ self range count
= liftDOM
(void (self ^. jsf "getAll" [toJSVal range, toJSVal count]))
getAll ::
(MonadDOM m, ToJSVal key) =>
IDBIndex -> key -> Maybe Word -> m IDBRequest
getAll self key count
= liftDOM
((self ^. jsf "getAll" [toJSVal key, toJSVal count]) >>=
fromJSValUnchecked)
getAll_ ::
(MonadDOM m, ToJSVal key) => IDBIndex -> key -> Maybe Word -> m ()
getAll_ self key count
= liftDOM
(void (self ^. jsf "getAll" [toJSVal key, toJSVal count]))
getAllKeysRange ::
(MonadDOM m) =>
IDBIndex -> Maybe IDBKeyRange -> Maybe Word -> m IDBRequest
getAllKeysRange self range count
= liftDOM
((self ^. jsf "getAllKeys" [toJSVal range, toJSVal count]) >>=
fromJSValUnchecked)
getAllKeysRange_ ::
(MonadDOM m) => IDBIndex -> Maybe IDBKeyRange -> Maybe Word -> m ()
getAllKeysRange_ self range count
= liftDOM
(void (self ^. jsf "getAllKeys" [toJSVal range, toJSVal count]))
getAllKeys ::
(MonadDOM m, ToJSVal key) =>
IDBIndex -> key -> Maybe Word -> m IDBRequest
getAllKeys self key count
= liftDOM
((self ^. jsf "getAllKeys" [toJSVal key, toJSVal count]) >>=
fromJSValUnchecked)
getAllKeys_ ::
(MonadDOM m, ToJSVal key) => IDBIndex -> key -> Maybe Word -> m ()
getAllKeys_ self key count
= liftDOM
(void (self ^. jsf "getAllKeys" [toJSVal key, toJSVal count]))
countRange ::
(MonadDOM m) => IDBIndex -> Maybe IDBKeyRange -> m IDBRequest
countRange self range
= liftDOM
((self ^. jsf "count" [toJSVal range]) >>= fromJSValUnchecked)
countRange_ ::
(MonadDOM m) => IDBIndex -> Maybe IDBKeyRange -> m ()
countRange_ self range
= liftDOM (void (self ^. jsf "count" [toJSVal range]))
count ::
(MonadDOM m, ToJSVal key) => IDBIndex -> key -> m IDBRequest
count self key
= liftDOM
((self ^. jsf "count" [toJSVal key]) >>= fromJSValUnchecked)
count_ :: (MonadDOM m, ToJSVal key) => IDBIndex -> key -> m ()
count_ self key
= liftDOM (void (self ^. jsf "count" [toJSVal key]))
setName :: (MonadDOM m, ToJSString val) => IDBIndex -> val -> m ()
setName self val = liftDOM (self ^. jss "name" (toJSVal val))
getName ::
(MonadDOM m, FromJSString result) => IDBIndex -> m result
getName self = liftDOM ((self ^. js "name") >>= fromJSValUnchecked)
getObjectStore :: (MonadDOM m) => IDBIndex -> m IDBObjectStore
getObjectStore self
= liftDOM ((self ^. js "objectStore") >>= fromJSValUnchecked)
getKeyPath :: (MonadDOM m) => IDBIndex -> m (Maybe IDBKeyPath)
getKeyPath self = liftDOM ((self ^. js "keyPath") >>= fromJSVal)
getKeyPathUnsafe ::
(MonadDOM m, HasCallStack) => IDBIndex -> m IDBKeyPath
getKeyPathUnsafe self
= liftDOM
(((self ^. js "keyPath") >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
getKeyPathUnchecked :: (MonadDOM m) => IDBIndex -> m IDBKeyPath
getKeyPathUnchecked self
= liftDOM ((self ^. js "keyPath") >>= fromJSValUnchecked)
getMultiEntry :: (MonadDOM m) => IDBIndex -> m Bool
getMultiEntry self
= liftDOM ((self ^. js "multiEntry") >>= valToBool)
getUnique :: (MonadDOM m) => IDBIndex -> m Bool
getUnique self = liftDOM ((self ^. js "unique") >>= valToBool)