squeal-postgresql-0.9.0.0: Squeal PostgreSQL Library
Copyright(c) Eitan Chatav 2019
Maintainereitan@morphism.tech
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Squeal.PostgreSQL.Expression.Composite

Description

composite functions

Synopsis

Composite Functions

row Source #

Arguments

:: 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))

rowStar Source #

Arguments

:: 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.

field Source #

Arguments

:: (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"