Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class DefaultRecTableField write read where
- defaultRecTableField :: String -> TableProperties write read
- class DefaultRecTable write read where
- defaultRecTable :: TableProperties (Rec Identity write) (Rec Identity read)
Documentation
class DefaultRecTableField write read where Source #
Helper typeclass which picks which of required
or optional
to use for a pair of write column type and read column type.
DefaultRecTableField (Maybe (Column a)) (Column a)
uses optional
.
DefaultRecTableField (Column a) (Column a)
uses required
.
defaultRecTableField :: String -> TableProperties write read Source #
Instances
DefaultRecTableField (Maybe (Column a)) (Column a) Source # | |
Defined in Composite.Opaleye.RecordTable defaultRecTableField :: String -> TableProperties (Maybe (Column a)) (Column a) Source # | |
DefaultRecTableField (Column a) (Column a) Source # | |
Defined in Composite.Opaleye.RecordTable defaultRecTableField :: String -> TableProperties (Column a) (Column a) Source # |
class DefaultRecTable write read where Source #
Type class for producing a default TableProperties
schema for some expected record types. required
and optional
are chosen automatically and the
column is named after the record fields, using NamedField
to reflect the field names.
For example, given:
type WriteRec = Record '["id" :-> Maybe (Column PGInt8), "name" :-> Column PGText] type ReadRec = Record '["id" :-> Column PGInt8 , "name" :-> Column PGText]
This:
defaultRecTable :: TableProperties WriteRec ReadRec
Is equivalent to:
pRec (optional "id" &: required "name" &: Nil)
Alternately, use pRec
and the usual Opaleye required
and optional
.
defaultRecTable :: TableProperties (Rec Identity write) (Rec Identity read) Source #
Instances
DefaultRecTable ([] :: [Type]) ([] :: [Type]) Source # | |
Defined in Composite.Opaleye.RecordTable defaultRecTable :: TableProperties (Rec Identity []) (Rec Identity []) Source # | |
(KnownSymbol s, DefaultRecTableField w r, DefaultRecTable writes reads) => DefaultRecTable ((s :-> w) ': writes) ((s :-> r) ': reads) Source # | |
Defined in Composite.Opaleye.RecordTable defaultRecTable :: TableProperties (Rec Identity ((s :-> w) ': writes)) (Rec Identity ((s :-> r) ': reads)) Source # |