Safe Haskell | None |
---|---|
Language | Haskell2010 |
Database module abstracts over a key-value database that supports CRUD operations.
This module follows the Handle pattern.
import qualified Imm.Database as Database
Synopsis
- class (Ord (Key t), Show (Key t), Show (Entry t), Typeable t, Show t, Pretty t, Pretty (Key t)) => Table t where
- data Handle m t = Handle {}
- readOnly :: Monad m => Pretty (Key t) => Handle m -> Handle m t -> Handle m t
- data DatabaseException t
- = NotCommitted t
- | NotDeleted t [Key t]
- | NotFound t [Key t]
- | NotInserted t [(Key t, Entry t)]
- | NotPurged t
- | NotUpdated t (Key t)
- | UnableFetchAll t
- fetch :: Monad m => Table t => MonadThrow m => Handle m t -> Key t -> m (Entry t)
- fetchList :: Monad m => Handle m t -> [Key t] -> m (Map (Key t) (Entry t))
- fetchAll :: Monad m => Handle m t -> m (Map (Key t) (Entry t))
- update :: Monad m => Handle m t -> Key t -> (Entry t -> Entry t) -> m ()
- insert :: Monad m => Handle m -> Handle m t -> Key t -> Entry t -> m ()
- insertList :: Monad m => Handle m -> Handle m t -> [(Key t, Entry t)] -> m ()
- delete :: Monad m => Handle m -> Handle m t -> Key t -> m ()
- deleteList :: Monad m => Handle m -> Handle m t -> [Key t] -> m ()
- purge :: Monad m => Handle m -> Handle m t -> m ()
- commit :: Monad m => Handle m -> Handle m t -> m ()
- table :: Table t => Handle m t -> t
Types
class (Ord (Key t), Show (Key t), Show (Entry t), Typeable t, Show t, Pretty t, Pretty (Key t)) => Table t where Source #
Generic database table
data DatabaseException t Source #
NotCommitted t | |
NotDeleted t [Key t] | |
NotFound t [Key t] | |
NotInserted t [(Key t, Entry t)] | |
NotPurged t | |
NotUpdated t (Key t) | |
UnableFetchAll t |
Instances
(Eq t, Eq (Key t), Eq (Entry t)) => Eq (DatabaseException t) Source # | |
Defined in Imm.Database (==) :: DatabaseException t -> DatabaseException t -> Bool # (/=) :: DatabaseException t -> DatabaseException t -> Bool # | |
(Show t, Show (Key t), Show (Entry t)) => Show (DatabaseException t) Source # | |
Defined in Imm.Database showsPrec :: Int -> DatabaseException t -> ShowS # show :: DatabaseException t -> String # showList :: [DatabaseException t] -> ShowS # | |
(Table t, Show (Key t), Show (Entry t), Pretty (Key t), Typeable t) => Exception (DatabaseException t) Source # | |
Defined in Imm.Database toException :: DatabaseException t -> SomeException # fromException :: SomeException -> Maybe (DatabaseException t) # displayException :: DatabaseException t -> String # | |
(Pretty t, Pretty (Key t)) => Pretty (DatabaseException t) Source # | |
Defined in Imm.Database pretty :: DatabaseException t -> Doc ann # prettyList :: [DatabaseException t] -> Doc ann # |