Safe Haskell | None |
---|---|
Language | Haskell98 |
- data Table writerColumns viewColumns
- = Table String (TableProperties writerColumns viewColumns)
- | TableWithSchema String String (TableProperties writerColumns viewColumns)
- tableIdentifier :: Table writerColumns viewColumns -> TableIdentifier
- tableProperties :: Table writerColumns viewColumns -> TableProperties writerColumns viewColumns
- data TableProperties writerColumns viewColumns = TableProperties {
- tablePropertiesWriter :: Writer writerColumns viewColumns
- tablePropertiesView :: View viewColumns
- data View columns = View columns
- newtype Writer columns dummy = Writer (forall f. Functor f => PackMap (f PrimExpr, String) () (f columns) ())
- queryTable :: ColumnMaker viewColumns columns -> Table writerColumns viewColumns -> Tag -> (columns, PrimQuery)
- runColumnMaker :: ColumnMaker tablecolumns columns -> Tag -> tablecolumns -> (columns, [(Symbol, PrimExpr)])
- runWriter :: Writer columns columns' -> columns -> [(PrimExpr, String)]
- runWriter' :: Writer columns columns' -> NonEmpty columns -> (NonEmpty [PrimExpr], [String])
- data Zip a = Zip {}
- required :: String -> Writer (Column a) (Column a)
- optional :: String -> Writer (Maybe (Column a)) (Column a)
Documentation
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 ( |
tableIdentifier :: Table writerColumns viewColumns -> TableIdentifier Source
tableProperties :: Table writerColumns viewColumns -> TableProperties writerColumns viewColumns Source
data TableProperties writerColumns viewColumns Source
TableProperties | |
|
queryTable :: ColumnMaker viewColumns columns -> Table writerColumns viewColumns -> Tag -> (columns, PrimQuery) Source
runColumnMaker :: ColumnMaker tablecolumns columns -> Tag -> tablecolumns -> (columns, [(Symbol, PrimExpr)]) Source