Define a table as follows, where "id", "color", "location",
"quantity" and "radius" are the table's fields 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 }
$(makeAdaptorAndInstanceInferrable "pWidget" ''Widget)
widgetTable :: Table (Widget (Maybe (Field SqlInt4)) (Field SqlText) (Field SqlText)
(Field SqlInt4) (Field SqlFloat8))
(Widget (Field SqlInt4) (Field SqlText) (Field SqlText)
(Field SqlInt4) (Field SqlFloat8))
widgetTable = table "widgetTable"
(pWidget Widget { wid = tableField "id"
, color = tableField "color"
, location = tableField "location"
, quantity = tableField "quantity"
, radius = tableField "radius" })
Constructors
Table String (TableFields writeFields viewFields)TableWithSchema String String (TableFields writeFields viewFields)
Instances2Profunctor, Functor
Profunctor TableDefined in opaleye-0.10.8.0 · Opaleye.Internal.TableFunctor (Table a)Defined in opaleye-0.10.8.0 · Opaleye.Internal.Table