Safe Haskell | None |
---|---|
Language | Haskell2010 |
An SQL-generating DSL targeting PostgreSQL. Allows Postgres queries to be written within Haskell in a typesafe and composable fashion.
You might like to look at
- Basic tutorial
- Manipulation tutorial
- Advanced tutorial
- If you are confused about the
Default
typeclass, then the Default explanation
Synopsis
- module Opaleye.Aggregate
- module Opaleye.Binary
- module Opaleye.Column
- module Opaleye.Constant
- module Opaleye.Distinct
- type Field a = Field_ NonNullable a
- type FieldNullable a = Field_ Nullable a
- data Nullability
- type family Field_ (a :: Nullability) b
- module Opaleye.FunctionalJoin
- module Opaleye.Join
- module Opaleye.Label
- module Opaleye.Manipulation
- module Opaleye.Operators
- module Opaleye.Order
- module Opaleye.PGTypes
- module Opaleye.QueryArr
- module Opaleye.RunQuery
- data Cursor haskells
- type FromFields = QueryRunner
- type FromField = QueryRunnerColumn
- 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
- runSelectExplicit :: FromFields fields haskells -> Connection -> Select fields -> IO [haskells]
- runSelectFoldExplicit :: FromFields fields haskells -> Connection -> Select fields -> b -> (b -> haskells -> IO b) -> IO b
- module Opaleye.Sql
- module Opaleye.Select
- module Opaleye.SqlTypes
- module Opaleye.Table
- module Opaleye.Values
Documentation
module Opaleye.Aggregate
module Opaleye.Binary
module Opaleye.Column
module Opaleye.Constant
module Opaleye.Distinct
type Field a = Field_ NonNullable a Source #
type FieldNullable a = Field_ Nullable a Source #
data Nullability Source #
Instances
type A (H NullsT :: Arr * (TC a) k2) (TC ((,) t b) :: TC a) Source # | |
type A (H WT :: Arr * (TC a) k2) (TC ((,) t Req) :: TC a) Source # | |
type A (H OT :: Arr * (TC a) k2) (TC ((,) t b) :: TC a) Source # | |
type A (H HT :: Arr * (TC a) k2) (TC ((,) t b) :: TC a) Source # | |
type A (H HT :: Arr * (C k2) k2) (C ((,,) h o NN) :: C k2) Source # | |
type A (H WT :: Arr * (TC a) *) (TC ((,) t Opt) :: TC a) Source # | |
type A (H NullsT :: Arr * (C *) *) (C ((,,) h o NN) :: C *) Source # | |
type A (H OT :: Arr * (C *) *) (C ((,,) h o N) :: C *) Source # | |
type A (H OT :: Arr * (C *) *) (C ((,,) h o NN) :: C *) Source # | |
type A (H HT :: Arr * (C *) *) (C ((,,) h o N) :: C *) Source # | |
type family Field_ (a :: Nullability) b Source #
Instances
type Field_ NonNullable a Source # | |
Defined in Opaleye.Field | |
type Field_ Nullable a Source # | |
Defined in Opaleye.Field |
module Opaleye.FunctionalJoin
module Opaleye.Join
module Opaleye.Label
module Opaleye.Manipulation
module Opaleye.Operators
module Opaleye.Order
module Opaleye.PGTypes
module Opaleye.QueryArr
module Opaleye.RunQuery
type FromFields = QueryRunner Source #
type FromField = QueryRunnerColumn Source #
:: 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.
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 #
module Opaleye.Sql
module Opaleye.Select
module Opaleye.SqlTypes
module Opaleye.Table
module Opaleye.Values