Copyright | (c) Eitan Chatav 2019 |
---|---|
Maintainer | eitan@morphism.tech |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
values statements
Synopsis
- values :: SListI cols => NP (Aliased (Expression 'Ungrouped lat with db params '[])) cols -> [NP (Aliased (Expression 'Ungrouped lat with db params '[])) cols] -> Query lat with db params cols
- values_ :: SListI cols => NP (Aliased (Expression 'Ungrouped lat with db params '[])) cols -> Query lat with db params cols
Values
:: SListI cols | |
=> NP (Aliased (Expression 'Ungrouped lat with db params '[])) cols | |
-> [NP (Aliased (Expression 'Ungrouped lat with db params '[])) cols] | When more than one row is specified, all the rows must must have the same number of elements |
-> Query lat with db params cols |
values
computes a row value or set of row values
specified by value expressions. It is most commonly used
to generate a “constant table” within a larger command,
but it can be used on its own.
>>>
type Row = '["a" ::: 'NotNull 'PGint4, "b" ::: 'NotNull 'PGtext]
>>>
let query = values (1 `as` #a :* "one" `as` #b) [] :: Query lat with db '[] Row
>>>
printSQL query
SELECT * FROM (VALUES ((1 :: int4), (E'one' :: text))) AS t ("a", "b")