Safe Haskell | None |
---|---|
Language | Haskell98 |
- runQuery :: Default QueryRunner columns haskells => Connection -> Query columns -> IO [haskells]
- runQueryExplicit :: QueryRunner columns haskells -> Connection -> Query columns -> IO [haskells]
- queryRunnerColumn :: (Column a' -> Column a) -> (b -> b') -> QueryRunnerColumn a b -> QueryRunnerColumn a' b'
- data QueryRunner columns haskells
- data QueryRunnerColumn coltype haskell
- fieldQueryRunnerColumn :: FromField haskell => QueryRunnerColumn coltype haskell
Documentation
runQuery :: Default QueryRunner columns haskells => Connection -> Query columns -> IO [haskells] Source
runQuery
'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
runQuery
.
Example type specialization:
runQuery :: Query (ColumnPGInt4
, ColumnPGText
) -> IO [(Column Int, Column String)]
Assuming the makeAdaptorAndInstance
splice has been run for the product type Foo
:
runQuery :: Query (Foo (ColumnPGInt4
) (ColumnPGText
) (ColumnPGBool
) -> IO [(Foo (Column Int) (Column String) (Column Bool)]
Opaleye types are converted to Haskell types based on instances of
the QueryRunnerColumnDefault
typeclass.
runQueryExplicit :: QueryRunner columns haskells -> Connection -> Query columns -> IO [haskells] Source
queryRunnerColumn :: (Column a' -> Column a) -> (b -> b') -> QueryRunnerColumn a b -> QueryRunnerColumn a' b' Source
Use queryRunnerColumn
to make an instance to allow you to run queries on
your own datatypes. For example:
newtype Foo = Foo Int
instance Default QueryRunnerColumn Foo Foo where
def = queryRunnerColumn (unsafeCoerce
:: Column Foo -> Column PGInt4) Foo def
data QueryRunner columns haskells Source
data QueryRunnerColumn coltype haskell Source
fieldQueryRunnerColumn :: FromField haskell => QueryRunnerColumn coltype haskell Source