Safe Haskell | None |
---|---|
Language | Haskell2010 |
An open API for implementation of specific backend drivers.
- class Cx c where
- type CxSettings c
- type CxError c
- data family ResultValue c
- type ResultRow c = Vector (ResultValue c)
- type ResultStream c = ListT IO (ResultRow c)
- type ResultMatrix c = Vector (ResultRow c)
- data Stmt c = Stmt {
- stmtTemplate :: !Text
- stmtParams :: !(Vector (StmtParam c))
- stmtPreparable :: !Bool
- data family StmtParam c
- class CxValue c v where
- class CxTx c where
- type TxError c
- data TxIsolationLevel
- type TxMode = Maybe (TxIsolationLevel, TxWriteMode)
- type TxWriteMode = Maybe Bool
- type Tx c = FreeT (TxF c) (MaybeT (EitherT (TxError c) IO))
- data TxF c x
- unitTx :: Stmt c -> Tx c ()
- countTx :: Stmt c -> Tx c Word64
- vectorTx :: Stmt c -> Tx c (Vector (ResultRow c))
- streamTx :: Int -> Stmt c -> Tx c (ListT (Tx c) (ResultRow c))
Connection
Results
data family ResultValue c Source #
A raw value returned from the database.
type ResultRow c = Vector (ResultValue c) Source #
A raw result row.
type ResultMatrix c = Vector (ResultRow c) Source #
A matrix of a result.
Statements
A statement template packed with its values and settings.
Stmt | |
|
Mapping
class CxValue c v where Source #
A support by a backend of mapping a specific data type.
encodeValue :: v -> StmtParam c Source #
decodeValue :: ResultValue c -> Either Text v Source #
Transaction
A transaction execution support.
data TxIsolationLevel Source #
For reference see the Wikipedia info.
type TxMode = Maybe (TxIsolationLevel, TxWriteMode) Source #
A mode, defining how a transaction should be executed.
Just (isolationLevel, write)
indicates that a database transaction should be established with a specified isolation level and a write mode.Nothing
indicates that there should be no database transaction established on the backend and therefore it should be executed with no ACID guarantees, but also without any induced overhead.
type TxWriteMode = Maybe Bool Source #
Nothing
indicates a "read" mode.Just True
indicates a "write" mode.Just False
indicates a "write" mode without committing. This is useful for testing, allowing you to modify your database, producing some result based on your changes, and to let Hasql roll all the changes back on the exit from the transaction.