-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A minimalistic general high level API for relational databases -- -- A robust and concise yet powerful API for communication with arbitrary -- relational databases. -- -- Features: -- --
-- selectFive :: Statement b -- selectFive = [q|SELECT (? + ?)|] 2 3 --q :: QuasiQuoter -- | Execute a statement, which produces no result. unit :: Backend b => Statement b -> Tx b s () -- | Execute a statement and count the amount of affected rows. Useful for -- resolving how many rows were updated or deleted. count :: Backend b => Mapping b Word64 => Statement b -> Tx b s Word64 -- | Execute a statement, which produces a single result row: a -- SELECT or an INSERT, which produces a generated -- value (e.g., an auto-incremented id). single :: Backend b => RowParser b r => Statement b -> Tx b s (Maybe r) -- | Execute a SELECT statement, and produce a vector of results. list :: Backend b => RowParser b r => Statement b -> Tx b s [r] -- | Execute a SELECT statement with a cursor, and produce a -- results stream. -- -- Cursor allows you to fetch virtually limitless results in a constant -- memory at a cost of a small overhead. Note that in most databases -- cursors require establishing a database transaction, so a -- NotInTransaction error will be raised if you run it improperly. stream :: Backend b => RowParser b r => Statement b -> TxListT s (Tx b s) r -- | A stream of results, which fetches only those that you reach. -- -- It's a wrapper around ListT, which uses the same trick as the -- ST monad to associate with the context transaction and become -- impossible to be used outside of it. This lets the library ensure that -- it is safe to automatically release all the resources associated with -- this stream. -- -- All the functions of the "list-t" library are applicable to this type, -- amongst which are head, toList, fold, -- traverse_. data TxListT s m r class RowParser b r parseRow :: RowParser b r => Vector (Result b) -> Either Text r -- | The only exception type that this API can raise. data Error -- | Cannot connect to a server. CantConnect :: Text -> Error -- | The connection got interrupted. ConnectionLost :: Text -> Error -- | An error returned from the database. ErroneousResult :: Text -> Error -- | Unexpected result structure. Indicates usage of inappropriate -- statement executor. UnexpectedResult :: Text -> Error -- | Incorrect statement template. UnparsableTemplate :: Text -> Error -- | An operation, which requires a database transaction was executed -- without one. NotInTransaction :: Error -- | Attempt to parse a row into an incompatible type. Indicates either a -- mismatching schema or an incorrect query. UnparsableRow :: Text -> Error instance Typeable Error instance Show Error instance Functor (Tx b s) instance Applicative (Tx b s) instance Monad (Tx b s) instance Functor m => Functor (TxListT s m) instance (Monad m, Functor m) => Applicative (TxListT s m) instance (Monad m, Functor m) => Alternative (TxListT s m) instance Monad m => Monad (TxListT s m) instance MonadTrans (TxListT s) instance Monad m => MonadPlus (TxListT s m) instance Monad m => Monoid (TxListT s m r) instance Monad m => ListMonad (TxListT s m) instance ListTrans (TxListT s) instance Exception Error