Safe Haskell | None |
---|---|
Language | Haskell98 |
- queryTable :: Default ColumnMaker columns columns => Table a columns -> Query columns
- queryTableExplicit :: ColumnMaker tablecolumns columns -> Table a tablecolumns -> Query columns
- required :: String -> TableProperties (Column a) (Column a)
- optional :: String -> TableProperties (Maybe (Column a)) (Column a)
- data View columns
- data Writer columns dummy
- data Table writerColumns viewColumns
- = Table String (TableProperties writerColumns viewColumns)
- | TableWithSchema String String (TableProperties writerColumns viewColumns)
- data TableProperties writerColumns viewColumns
Documentation
queryTable :: Default ColumnMaker columns columns => Table a columns -> Query columns Source
Example type specialization:
queryTable :: Table w (Column a, Column b) -> Query (Column a, Column b)
Assuming the makeAdaptorAndInstance
splice has been run for the
product type Foo
:
queryTable :: Table w (Foo (Column a) (Column b) (Column c)) -> Query (Foo (Column a) (Column b) (Column c))
queryTableExplicit :: ColumnMaker tablecolumns columns -> Table a tablecolumns -> Query columns Source
data Table writerColumns viewColumns Source
Define a table as follows, where "id", "color", "location",
"quantity" and "radius" are the tables columns in Postgres and
the types are given in the type signature. The id
field is an
autoincrementing field (i.e. optional for writes).
data Widget a b c d e = Widget { wid :: a
, color :: b
, location :: c
, quantity :: d
, radius :: e }
$(makeAdaptorAndInstance
"pWidget" ''Widget)
widgetTable :: Table (Widget (Maybe (Column PGInt4)) (Column PGText) (Column PGText)
(Column PGInt4) (Column PGFloat8))
(Widget (Column PGText) (Column PGText) (Column PGText)
(Column PGInt4) (Column PGFloat8))
widgetTable = Table "widgetTable"
(pWidget Widget { wid = optional "id"
, color = required "color"
, location = required "location"
, quantity = required "quantity"
, radius = required "radius" })
Table String (TableProperties writerColumns viewColumns) | Uses the default schema name ( |
TableWithSchema String String (TableProperties writerColumns viewColumns) | Schema name ( |
data TableProperties writerColumns viewColumns Source