Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- runSelect :: Default FromFields fields haskells => Connection -> Select fields -> IO [haskells]
- runSelectTF :: Default FromFields (rec O) (rec H) => Connection -> Select (rec O) -> IO [rec H]
- runSelectFold :: Default FromFields fields haskells => Connection -> Select fields -> b -> (b -> haskells -> IO b) -> IO b
- declareCursor :: Default FromFields fields haskells => Connection -> Select fields -> IO (Cursor haskells)
- closeCursor :: Cursor fields -> IO ()
- foldForward :: Cursor haskells -> Int -> (a -> haskells -> IO a) -> a -> IO (Either a a)
- runSelectExplicit :: FromFields fields haskells -> Connection -> Select fields -> IO [haskells]
- runSelectFoldExplicit :: FromFields fields haskells -> Connection -> Select fields -> b -> (b -> haskells -> IO b) -> IO b
- declareCursorExplicit :: FromFields fields haskells -> Connection -> Select fields -> IO (Cursor haskells)
- data Cursor haskells
- type FromFields = QueryRunner
- type FromField = QueryRunnerColumn
Documentation
:: Default FromFields fields haskells | |
=> Connection | |
-> Select fields | |
-> IO [haskells] |
runSelect
's use of the Default
typeclass means that the
compiler will have trouble inferring types. It is strongly
recommended that you provide full type signatures when using
runSelect
.
Example type specialization:
runSelect ::Select
(ColumnSqlInt4
, ColumnSqlText
) -> IO [(Int, String)]
Assuming the makeAdaptorAndInstance
splice has been run for the product type Foo
:
runSelect ::Select
(Foo (ColumnSqlInt4
) (ColumnSqlText
) (ColumnSqlBool
) -> IO [Foo Int String Bool]
:: Default FromFields (rec O) (rec H) | |
=> Connection | |
-> Select (rec O) | |
-> IO [rec H] |
runSelectTF
has better type inference than runSelect
but only
works with "higher-kinded data" types.
:: Default FromFields fields haskells | |
=> Connection | |
-> Select fields | |
-> b | |
-> (b -> haskells -> IO b) | |
-> IO b |
runSelectFold
streams the results of a query incrementally and consumes
the results with a left fold.
This fold is not strict. The stream consumer is responsible for forcing the evaluation of its result to avoid space leaks.
:: Default FromFields fields haskells | |
=> Connection | |
-> Select fields | |
-> IO (Cursor haskells) |
Declare a temporary cursor. The cursor is given a unique name for the given connection.
Returns Nothing
when the query returns zero rows.
closeCursor :: Cursor fields -> IO () Source #
Close the given cursor.
runSelectExplicit :: FromFields fields haskells -> Connection -> Select fields -> IO [haskells] Source #
runSelectFoldExplicit :: FromFields fields haskells -> Connection -> Select fields -> b -> (b -> haskells -> IO b) -> IO b Source #
declareCursorExplicit :: FromFields fields haskells -> Connection -> Select fields -> IO (Cursor haskells) Source #
Datatypes
type FromFields = QueryRunner Source #
type FromField = QueryRunnerColumn Source #