Copyright | (c) Eitan Chatav 2019 |
---|---|
Maintainer | eitan@morphism.tech |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
composite functions
Synopsis
- row :: SListI row => NP (Aliased (Expression grp lat with db params from)) row -> Expression grp lat with db params from (null ('PGcomposite row))
- rowStar :: Has tab from row => Alias tab -> Expression grp lat with db params from (null ('PGcomposite row))
- field :: (relss ~ DbRelations db, Has sch relss rels, Has rel rels row, Has field row ty) => QualifiedAlias sch rel -> Alias field -> Expression grp lat with db params from ('NotNull ('PGcomposite row)) -> Expression grp lat with db params from ty
Composite Functions
:: SListI row | |
=> NP (Aliased (Expression grp lat with db params from)) row | zero or more expressions for the row field values |
-> Expression grp lat with db params from (null ('PGcomposite row)) |
A row constructor is an expression that builds a row value (also called a composite value) using values for its member fields.
>>>
:{
type Complex = 'PGcomposite '[ "real" ::: 'NotNull 'PGfloat8 , "imaginary" ::: 'NotNull 'PGfloat8 ] :}
>>>
let i = row (0 `as` #real :* 1 `as` #imaginary) :: Expression grp lat with db params from ('NotNull Complex)
>>>
printSQL i
ROW((0.0 :: float8), (1.0 :: float8))
:: Has tab from row | |
=> Alias tab | intermediate table |
-> Expression grp lat with db params from (null ('PGcomposite row)) |
A row constructor on all columns in a table expression.
:: (relss ~ DbRelations db, Has sch relss rels, Has rel rels row, Has field row ty) | |
=> QualifiedAlias sch rel | row type |
-> Alias field | field name |
-> Expression grp lat with db params from ('NotNull ('PGcomposite row)) | |
-> Expression grp lat with db params from ty |
>>>
:{
type Complex = 'PGcomposite '[ "real" ::: 'NotNull 'PGfloat8 , "imaginary" ::: 'NotNull 'PGfloat8 ] type Schema = '["complex" ::: 'Typedef Complex] :}
>>>
let i = row (0 `as` #real :* 1 `as` #imaginary) :: Expression lat '[] grp (Public Schema) from params ('NotNull Complex)
>>>
printSQL $ i & field #complex #imaginary
(ROW((0.0 :: float8), (1.0 :: float8))::"complex")."imaginary"