@@ -198,7 +198,7 @@ class (PGTyped (PGTypeOf ty), KnownNat n) => HasParameter
198 (params :: [NullityType])
198 (params :: [NullityType])
199 (ty :: NullityType)
199 (ty :: NullityType)
200 | n params -> ty where
200 | n params -> ty where
201− param :: Expression tables grouping params ty
201+ param :: Expression relations grouping params ty
202 param = UnsafeExpression $ parenthesized $
202 param = UnsafeExpression $ parenthesized $
203 "$" <> renderNat (Proxy @n) <+> "::"
203 "$" <> renderNat (Proxy @n) <+> "::"
204 <+> renderTypeExpression (pgtype @(PGTypeOf ty))
204 <+> renderTypeExpression (pgtype @(PGTypeOf ty))
@@ -207,61 +207,61 @@ instance {-# OVERLAPPING #-} PGTyped (PGTypeOf ty1)
207instance {-# OVERLAPPABLE #-} (KnownNat n, HasParameter (n-1) params ty)
207instance {-# OVERLAPPABLE #-} (KnownNat n, HasParameter (n-1) params ty)
208 => HasParameter n (ty' : params) ty
208 => HasParameter n (ty' : params) ty
210−instance (HasUnique table tables columns, Has column columns ty)
210+instance (HasUnique relation relations columns, Has column columns ty)
211− => IsLabel column (Expression tables 'Ungrouped params ty) where
211+ => IsLabel column (Expression relations 'Ungrouped params ty) where
212 fromLabel = UnsafeExpression $ renderAlias (Alias @column)
212 fromLabel = UnsafeExpression $ renderAlias (Alias @column)
214−instance (Has table tables columns, Has column columns ty)
214+instance (Has relation relations columns, Has column columns ty)
215− => IsTableColumn table column (Expression tables 'Ungrouped params ty) where
215+ => IsTableColumn relation column (Expression relations 'Ungrouped params ty) where
216− table ! column = UnsafeExpression $
216+ relation ! column = UnsafeExpression $
217− renderAlias table <> "." <> renderAlias column
217+ renderAlias relation <> "." <> renderAlias column
219{- | A `GroupedBy` constraint indicates that a table qualified column is
219{- | A `GroupedBy` constraint indicates that a table qualified column is
220a member of the auxiliary namespace created by @GROUP BY@ clauses and thus,
220a member of the auxiliary namespace created by @GROUP BY@ clauses and thus,
221may be called in an output `Expression` without aggregating.
221may be called in an output `Expression` without aggregating.
223−class (KnownSymbol table, KnownSymbol column)
223+class (KnownSymbol relation, KnownSymbol column)
224− => GroupedBy table column bys where
224+ => GroupedBy relation column bys where
225 getGroup1
225 getGroup1
226− :: (HasUnique table tables columns, Has column columns ty)
226+ :: (HasUnique relation relations columns, Has column columns ty)
227 => Alias column
227 => Alias column
228− -> Expression tables ('Grouped bys) params ty
228+ -> Expression relations ('Grouped bys) params ty
229 getGroup1 column = UnsafeExpression $ renderAlias column
229 getGroup1 column = UnsafeExpression $ renderAlias column
230 getGroup2
230 getGroup2
231− :: (Has table tables columns, Has column columns ty)
231+ :: (Has relation relations columns, Has column columns ty)
232− => Alias table
232+ => Alias relation
233 -> Alias column
233 -> Alias column
234− -> Expression tables ('Grouped bys) params ty
234+ -> Expression relations ('Grouped bys) params ty
235− getGroup2 table column = UnsafeExpression $
235+ getGroup2 relation column = UnsafeExpression $
236− renderAlias table <> "." <> renderAlias column
236+ renderAlias relation <> "." <> renderAlias column
237−instance {-# OVERLAPPING #-} (KnownSymbol table, KnownSymbol column)
237+instance {-# OVERLAPPING #-} (KnownSymbol relation, KnownSymbol column)
238− => GroupedBy table column ('(table,column) ': bys)
238+ => GroupedBy relation column ('(table,column) ': bys)
239instance {-# OVERLAPPABLE #-}
239instance {-# OVERLAPPABLE #-}
240− ( KnownSymbol table
240+ ( KnownSymbol relation
241 , KnownSymbol column
241 , KnownSymbol column
242− , GroupedBy table column bys
242+ , GroupedBy relation column bys
243− ) => GroupedBy table column (tabcol ': bys)
243+ ) => GroupedBy relation column (tabcol ': bys)
246− ( HasUnique table tables columns
246+ ( HasUnique relation relations columns
247 , Has column columns ty
247 , Has column columns ty
248− , GroupedBy table column bys
248+ , GroupedBy relation column bys
249 ) => IsLabel column
249 ) => IsLabel column
250− (Expression tables ('Grouped bys) params ty) where
250+ (Expression relations ('Grouped bys) params ty) where
251 fromLabel = getGroup1 (Alias @column)
251 fromLabel = getGroup1 (Alias @column)
254− ( Has table tables columns
254+ ( Has relation relations columns
255 , Has column columns ty
255 , Has column columns ty
256− , GroupedBy table column bys
256+ , GroupedBy relation column bys
257− ) => IsTableColumn table column
257+ ) => IsTableColumn relation column
258− (Expression tables ('Grouped bys) params ty) where (!) = getGroup2
258+ (Expression relations ('Grouped bys) params ty) where (!) = getGroup2
260-- | analagous to `Nothing`
260-- | analagous to `Nothing`
262-- >>> renderExpression $ null_
262-- >>> renderExpression $ null_
264−null_ :: Expression tables grouping params ('Null ty)
264+null_ :: Expression relations grouping params ('Null ty)
265null_ = UnsafeExpression "NULL"
265null_ = UnsafeExpression "NULL"
267-- | analagous to `Just`
267-- | analagous to `Just`
@@ -269,9 +269,9 @@ null_ = UnsafeExpression "NULL"
269-- >>> renderExpression $ unNull true
269-- >>> renderExpression $ unNull true
272− :: Expression tables grouping params ('NotNull ty)
272+ :: Expression relations grouping params ('NotNull ty)
273 -- ^ not @NULL@
273 -- ^ not @NULL@
274− -> Expression tables grouping params ('Null ty)
274+ -> Expression relations grouping params ('Null ty)
275unNull = UnsafeExpression . renderExpression
275unNull = UnsafeExpression . renderExpression
277-- | return the leftmost value which is not NULL
277-- | return the leftmost value which is not NULL
@@ -279,11 +279,11 @@ unNull = UnsafeExpression . renderExpression
279-- >>> renderExpression $ coalesce [null_, unNull true] false
279-- >>> renderExpression $ coalesce [null_, unNull true] false
280-- "COALESCE(NULL, TRUE, FALSE)"
280-- "COALESCE(NULL, TRUE, FALSE)"
282− :: [Expression tables grouping params ('Null ty)]
282+ :: [Expression relations grouping params ('Null ty)]
283 -- ^ @NULL@s may be present
283 -- ^ @NULL@s may be present
284− -> Expression tables grouping params ('NotNull ty)
284+ -> Expression relations grouping params ('NotNull ty)
285 -- ^ @NULL@ is absent
285 -- ^ @NULL@ is absent
286− -> Expression tables grouping params ('NotNull ty)
286+ -> Expression relations grouping params ('NotNull ty)
287coalesce nullxs notNullx = UnsafeExpression $
287coalesce nullxs notNullx = UnsafeExpression $
288 "COALESCE" <> parenthesized (commaSeparated
288 "COALESCE" <> parenthesized (commaSeparated
289 ((renderExpression <$> nullxs) <> [renderExpression notNullx]))
289 ((renderExpression <$> nullxs) <> [renderExpression notNullx]))
@@ -293,26 +293,26 @@ coalesce nullxs notNullx = UnsafeExpression $
293-- >>> renderExpression $ fromNull true null_
293-- >>> renderExpression $ fromNull true null_
294-- "COALESCE(NULL, TRUE)"
294-- "COALESCE(NULL, TRUE)"
296− :: Expression tables grouping params ('NotNull ty)
296+ :: Expression relations grouping params ('NotNull ty)
297 -- ^ what to convert @NULL@ to
297 -- ^ what to convert @NULL@ to
298− -> Expression tables grouping params ('Null ty)
298+ -> Expression relations grouping params ('Null ty)
299− -> Expression tables grouping params ('NotNull ty)
299+ -> Expression relations grouping params ('NotNull ty)
300fromNull notNullx nullx = coalesce [nullx] notNullx
300fromNull notNullx nullx = coalesce [nullx] notNullx
302-- | >>> renderExpression $ null_ & isNull
302-- | >>> renderExpression $ null_ & isNull
303-- "NULL IS NULL"
303-- "NULL IS NULL"
305− :: Expression tables grouping params ('Null ty)
305+ :: Expression relations grouping params ('Null ty)
306 -- ^ possibly @NULL@
306 -- ^ possibly @NULL@
307− -> Condition tables grouping params
307+ -> Condition relations grouping params
308isNull x = UnsafeExpression $ renderExpression x <+> "IS NULL"
308isNull x = UnsafeExpression $ renderExpression x <+> "IS NULL"
310-- | >>> renderExpression $ null_ & isn'tNull
310-- | >>> renderExpression $ null_ & isn'tNull
311-- "NULL IS NOT NULL"
311-- "NULL IS NOT NULL"
313− :: Expression tables grouping params ('Null ty)
313+ :: Expression relations grouping params ('Null ty)
314 -- ^ possibly @NULL@
314 -- ^ possibly @NULL@
315− -> Condition tables grouping params
315+ -> Condition relations grouping params
316isn'tNull x = UnsafeExpression $ renderExpression x <+> "IS NOT NULL"
316isn'tNull x = UnsafeExpression $ renderExpression x <+> "IS NOT NULL"
318-- | analagous to `maybe` using @IS NULL@
318-- | analagous to `maybe` using @IS NULL@
@@ -320,13 +320,13 @@ isn'tNull x = UnsafeExpression $ renderExpression x <+> "IS NOT NULL"
320-- >>> renderExpression $ matchNull true not_ null_
320-- >>> renderExpression $ matchNull true not_ null_
321-- "CASE WHEN NULL IS NULL THEN TRUE ELSE (NOT NULL) END"
321-- "CASE WHEN NULL IS NULL THEN TRUE ELSE (NOT NULL) END"
323− :: Expression tables grouping params (nullty)
323+ :: Expression relations grouping params (nullty)
324 -- ^ what to convert @NULL@ to
324 -- ^ what to convert @NULL@ to
325− -> ( Expression tables grouping params ('NotNull ty)
325+ -> ( Expression relations grouping params ('NotNull ty)
326− -> Expression tables grouping params (nullty) )
326+ -> Expression relations grouping params (nullty) )
327 -- ^ function to perform when @NULL@ is absent
327 -- ^ function to perform when @NULL@ is absent
328− -> Expression tables grouping params ('Null ty)
328+ -> Expression relations grouping params ('Null ty)
329− -> Expression tables grouping params (nullty)
329+ -> Expression relations grouping params (nullty)
330matchNull y f x = ifThenElse (isNull x) y
330matchNull y f x = ifThenElse (isNull x) y
331 (f (UnsafeExpression (renderExpression x)))
331 (f (UnsafeExpression (renderExpression x)))
@@ -337,47 +337,47 @@ matchNull y f x = ifThenElse (isNull x) y
337-- >>> renderExpression @_ @_ @'[_] $ fromNull false (nullIf false (param @1))
337-- >>> renderExpression @_ @_ @'[_] $ fromNull false (nullIf false (param @1))
338-- "COALESCE(NULL IF (FALSE, ($1 :: bool)), FALSE)"
338-- "COALESCE(NULL IF (FALSE, ($1 :: bool)), FALSE)"
340− :: Expression tables grouping params ('NotNull ty)
340+ :: Expression relations grouping params ('NotNull ty)
341 -- ^ @NULL@ is absent
341 -- ^ @NULL@ is absent
342− -> Expression tables grouping params ('NotNull ty)
342+ -> Expression relations grouping params ('NotNull ty)
343 -- ^ @NULL@ is absent
343 -- ^ @NULL@ is absent
344− -> Expression tables grouping params ('Null ty)
344+ -> Expression relations grouping params ('Null ty)
345nullIf x y = UnsafeExpression $ "NULL IF" <+> parenthesized
345nullIf x y = UnsafeExpression $ "NULL IF" <+> parenthesized
346 (renderExpression x <> ", " <> renderExpression y)
346 (renderExpression x <> ", " <> renderExpression y)
348-- | >>> renderExpression $ array [null_, unNull false, unNull true]
348-- | >>> renderExpression $ array [null_, unNull false, unNull true]
349-- "ARRAY[NULL, FALSE, TRUE]"
349-- "ARRAY[NULL, FALSE, TRUE]"
351− :: [Expression tables grouping params ('Null ty)]
351+ :: [Expression relations grouping params ('Null ty)]
352 -- ^ array elements
352 -- ^ array elements
353− -> Expression tables grouping params (nullity ('PGvararray ty))
353+ -> Expression relations grouping params (nullity ('PGvararray ty))
354array xs = UnsafeExpression $
354array xs = UnsafeExpression $
355 "ARRAY[" <> commaSeparated (renderExpression <$> xs) <> "]"
355 "ARRAY[" <> commaSeparated (renderExpression <$> xs) <> "]"
357instance Monoid
357instance Monoid
358− (Expression tables grouping params (nullity ('PGvararray ty))) where
358+ (Expression relations grouping params (nullity ('PGvararray ty))) where
359 mempty = array []
359 mempty = array []
360 mappend = unsafeBinaryOp "||"
360 mappend = unsafeBinaryOp "||"
362-- | >>> renderExpression @_ @_ @'[_] $ greatest currentTimestamp [param @1]
362-- | >>> renderExpression @_ @_ @'[_] $ greatest currentTimestamp [param @1]
363-- "GREATEST(CURRENT_TIMESTAMP, ($1 :: timestamp with time zone))"
363-- "GREATEST(CURRENT_TIMESTAMP, ($1 :: timestamp with time zone))"
365− :: Expression tables grouping params (nullty)
365+ :: Expression relations grouping params (nullty)
366 -- ^ needs at least 1 argument
366 -- ^ needs at least 1 argument
367− -> [Expression tables grouping params (nullty)]
367+ -> [Expression relations grouping params (nullty)]
368 -- ^ or more
368 -- ^ or more
369− -> Expression tables grouping params (nullty)
369+ -> Expression relations grouping params (nullty)
370greatest x xs = UnsafeExpression $ "GREATEST("
370greatest x xs = UnsafeExpression $ "GREATEST("
371 <> commaSeparated (renderExpression <$> (x:xs)) <> ")"
371 <> commaSeparated (renderExpression <$> (x:xs)) <> ")"
373-- | >>> renderExpression $ least currentTimestamp [null_]
373-- | >>> renderExpression $ least currentTimestamp [null_]
374-- "LEAST(CURRENT_TIMESTAMP, NULL)"
374-- "LEAST(CURRENT_TIMESTAMP, NULL)"
376− :: Expression tables grouping params (nullty)
376+ :: Expression relations grouping params (nullty)
377 -- ^ needs at least 1 argument
377 -- ^ needs at least 1 argument
378− -> [Expression tables grouping params (nullty)]
378+ -> [Expression relations grouping params (nullty)]
379 -- ^ or more
379 -- ^ or more
380− -> Expression tables grouping params (nullty)
380+ -> Expression relations grouping params (nullty)
381least x xs = UnsafeExpression $ "LEAST("
381least x xs = UnsafeExpression $ "LEAST("
382 <> commaSeparated (renderExpression <$> (x:xs)) <> ")"
382 <> commaSeparated (renderExpression <$> (x:xs)) <> ")"
@@ -386,9 +386,9 @@ least x xs = UnsafeExpression $ "LEAST("
386unsafeBinaryOp
386unsafeBinaryOp
387 :: ByteString
387 :: ByteString
388 -- ^ operator
388 -- ^ operator
389− -> Expression tables grouping params (ty0)
389+ -> Expression relations grouping params (ty0)
390− -> Expression tables grouping params (ty1)
390+ -> Expression relations grouping params (ty1)
391− -> Expression tables grouping params (ty2)
391+ -> Expression relations grouping params (ty2)
392unsafeBinaryOp op x y = UnsafeExpression $ parenthesized $
392unsafeBinaryOp op x y = UnsafeExpression $ parenthesized $
393 renderExpression x <+> op <+> renderExpression y
393 renderExpression x <+> op <+> renderExpression y
@@ -397,8 +397,8 @@ unsafeBinaryOp op x y = UnsafeExpression $ parenthesized $
397unsafeUnaryOp
397unsafeUnaryOp
398 :: ByteString
398 :: ByteString
399 -- ^ operator
399 -- ^ operator
400− -> Expression tables grouping params (ty0)
400+ -> Expression relations grouping params (ty0)
401− -> Expression tables grouping params (ty1)
401+ -> Expression relations grouping params (ty1)
402unsafeUnaryOp op x = UnsafeExpression $ parenthesized $
402unsafeUnaryOp op x = UnsafeExpression $ parenthesized $
403 op <+> renderExpression x
403 op <+> renderExpression x
@@ -407,13 +407,13 @@ unsafeUnaryOp op x = UnsafeExpression $ parenthesized $
407unsafeFunction
407unsafeFunction
408 :: ByteString
408 :: ByteString
409 -- ^ function
409 -- ^ function
410− -> Expression tables grouping params (xty)
410+ -> Expression relations grouping params (xty)
411− -> Expression tables grouping params (yty)
411+ -> Expression relations grouping params (yty)
412unsafeFunction fun x = UnsafeExpression $
412unsafeFunction fun x = UnsafeExpression $
413 fun <> parenthesized (renderExpression x)
413 fun <> parenthesized (renderExpression x)
415instance PGNum ty
415instance PGNum ty
416− => Num (Expression tables grouping params (nullity ty)) where
416+ => Num (Expression relations grouping params (nullity ty)) where
417 (+) = unsafeBinaryOp "+"
417 (+) = unsafeBinaryOp "+"
418 (-) = unsafeBinaryOp "-"
418 (-) = unsafeBinaryOp "-"
419 (*) = unsafeBinaryOp "*"
419 (*) = unsafeBinaryOp "*"
@@ -425,12 +425,12 @@ instance PGNum ty
427instance (PGNum ty, PGFloating ty) => Fractional
427instance (PGNum ty, PGFloating ty) => Fractional
428− (Expression tables grouping params (nullity ty)) where
428+ (Expression relations grouping params (nullity ty)) where
429 (/) = unsafeBinaryOp "/"
429 (/) = unsafeBinaryOp "/"
430 fromRational x = fromInteger (numerator x) / fromInteger (denominator x)
430 fromRational x = fromInteger (numerator x) / fromInteger (denominator x)
432instance (PGNum ty, PGFloating ty) => Floating
432instance (PGNum ty, PGFloating ty) => Floating
433− (Expression tables grouping params (nullity ty)) where
433+ (Expression relations grouping params (nullity ty)) where
434 pi = UnsafeExpression "pi()"
434 pi = UnsafeExpression "pi()"
435 exp = unsafeFunction "exp"
435 exp = unsafeFunction "exp"
436 log = unsafeFunction "ln"
436 log = unsafeFunction "ln"
@@ -453,18 +453,18 @@ instance (PGNum ty, PGFloating ty) => Floating
454-- | >>> :{
454-- | >>> :{
456−-- expression :: Expression tables grouping params (nullity 'PGfloat4)
456+-- expression :: Expression relations grouping params (nullity 'PGfloat4)
457-- expression = atan2_ pi 2
457-- expression = atan2_ pi 2
458-- in renderExpression expression
458-- in renderExpression expression
460-- "atan2(pi(), 2)"
460-- "atan2(pi(), 2)"
462 :: PGFloating float
462 :: PGFloating float
463− => Expression tables grouping params (nullity float)
463+ => Expression relations grouping params (nullity float)
464 -- ^ numerator
464 -- ^ numerator
465− -> Expression tables grouping params (nullity float)
465+ -> Expression relations grouping params (nullity float)
466 -- ^ denominator
466 -- ^ denominator
467− -> Expression tables grouping params (nullity float)
467+ -> Expression relations grouping params (nullity float)
468atan2_ y x = UnsafeExpression $
468atan2_ y x = UnsafeExpression $
469 "atan2(" <> renderExpression y <> ", " <> renderExpression x <> ")"
469 "atan2(" <> renderExpression y <> ", " <> renderExpression x <> ")"
@@ -477,9 +477,9 @@ atan2_ y x = UnsafeExpression $
478 :: TypeExpression ('NoDef :=> 'Null ty1)
478 :: TypeExpression ('NoDef :=> 'Null ty1)
479 -- ^ type to cast as
479 -- ^ type to cast as
480− -> Expression tables grouping params (nullity ty0)
480+ -> Expression relations grouping params (nullity ty0)
481 -- ^ value to convert
481 -- ^ value to convert
482− -> Expression tables grouping params (nullity ty1)
482+ -> Expression relations grouping params (nullity ty1)
483cast ty x = UnsafeExpression $ parenthesized $
483cast ty x = UnsafeExpression $ parenthesized $
484 renderExpression x <+> "::" <+> renderTypeExpression ty
484 renderExpression x <+> "::" <+> renderTypeExpression ty
@@ -487,133 +487,133 @@ cast ty x = UnsafeExpression $ parenthesized $
490−-- expression :: Expression tables grouping params (nullity 'PGint2)
490+-- expression :: Expression relations grouping params (nullity 'PGint2)
491-- expression = 5 `quot_` 2
491-- expression = 5 `quot_` 2
492-- in renderExpression expression
492-- in renderExpression expression
494-- "(5 / 2)"
494-- "(5 / 2)"
496 :: PGIntegral int
496 :: PGIntegral int
497− => Expression tables grouping params (nullity int)
497+ => Expression relations grouping params (nullity int)
498 -- ^ numerator
498 -- ^ numerator
499− -> Expression tables grouping params (nullity int)
499+ -> Expression relations grouping params (nullity int)
500 -- ^ denominator
500 -- ^ denominator
501− -> Expression tables grouping params (nullity int)
501+ -> Expression relations grouping params (nullity int)
502quot_ = unsafeBinaryOp "/"
502quot_ = unsafeBinaryOp "/"
504-- | remainder upon integer division
504-- | remainder upon integer division
508−-- expression :: Expression tables grouping params (nullity 'PGint2)
508+-- expression :: Expression relations grouping params (nullity 'PGint2)
509-- expression = 5 `rem_` 2
509-- expression = 5 `rem_` 2
510-- in renderExpression expression
510-- in renderExpression expression
512-- "(5 % 2)"
512-- "(5 % 2)"
514 :: PGIntegral int
514 :: PGIntegral int
515− => Expression tables grouping params (nullity int)
515+ => Expression relations grouping params (nullity int)
516 -- ^ numerator
516 -- ^ numerator
517− -> Expression tables grouping params (nullity int)
517+ -> Expression relations grouping params (nullity int)
518 -- ^ denominator
518 -- ^ denominator
519− -> Expression tables grouping params (nullity int)
519+ -> Expression relations grouping params (nullity int)
520rem_ = unsafeBinaryOp "%"
520rem_ = unsafeBinaryOp "%"
522-- | >>> :{
522-- | >>> :{
524−-- expression :: Expression tables grouping params (nullity 'PGfloat4)
524+-- expression :: Expression relations grouping params (nullity 'PGfloat4)
525-- expression = trunc pi
525-- expression = trunc pi
526-- in renderExpression expression
526-- in renderExpression expression
528-- "trunc(pi())"
528-- "trunc(pi())"
530 :: PGFloating frac
530 :: PGFloating frac
531− => Expression tables grouping params (nullity frac)
531+ => Expression relations grouping params (nullity frac)
532 -- ^ fractional number
532 -- ^ fractional number
533− -> Expression tables grouping params (nullity frac)
533+ -> Expression relations grouping params (nullity frac)
534trunc = unsafeFunction "trunc"
534trunc = unsafeFunction "trunc"
536-- | >>> :{
536-- | >>> :{
538−-- expression :: Expression tables grouping params (nullity 'PGfloat4)
538+-- expression :: Expression relations grouping params (nullity 'PGfloat4)
539-- expression = round_ pi
539-- expression = round_ pi
540-- in renderExpression expression
540-- in renderExpression expression
542-- "round(pi())"
542-- "round(pi())"
544 :: PGFloating frac
544 :: PGFloating frac
545− => Expression tables grouping params (nullity frac)
545+ => Expression relations grouping params (nullity frac)
546 -- ^ fractional number
546 -- ^ fractional number
547− -> Expression tables grouping params (nullity frac)
547+ -> Expression relations grouping params (nullity frac)
548round_ = unsafeFunction "round"
548round_ = unsafeFunction "round"
550-- | >>> :{
550-- | >>> :{
552−-- expression :: Expression tables grouping params (nullity 'PGfloat4)
552+-- expression :: Expression relations grouping params (nullity 'PGfloat4)
553-- expression = ceiling_ pi
553-- expression = ceiling_ pi
554-- in renderExpression expression
554-- in renderExpression expression
556-- "ceiling(pi())"
556-- "ceiling(pi())"
558 :: PGFloating frac
558 :: PGFloating frac
559− => Expression tables grouping params (nullity frac)
559+ => Expression relations grouping params (nullity frac)
560 -- ^ fractional number
560 -- ^ fractional number
561− -> Expression tables grouping params (nullity frac)
561+ -> Expression relations grouping params (nullity frac)
562ceiling_ = unsafeFunction "ceiling"
562ceiling_ = unsafeFunction "ceiling"
564-- | A `Condition` is a boolean valued `Expression`. While SQL allows
564-- | A `Condition` is a boolean valued `Expression`. While SQL allows
565-- conditions to have @NULL@, squeal instead chooses to disallow @NULL@,
565-- conditions to have @NULL@, squeal instead chooses to disallow @NULL@,
566-- forcing one to handle the case of @NULL@ explicitly to produce
566-- forcing one to handle the case of @NULL@ explicitly to produce
567-- a `Condition`.
567-- a `Condition`.
568−type Condition tables grouping params =
568+type Condition relations grouping params =
569− Expression tables grouping params ('NotNull 'PGbool)
569+ Expression relations grouping params ('NotNull 'PGbool)
571-- | >>> renderExpression true
571-- | >>> renderExpression true
573−true :: Condition tables grouping params
573+true :: Condition relations grouping params
574true = UnsafeExpression "TRUE"
574true = UnsafeExpression "TRUE"
576-- | >>> renderExpression false
576-- | >>> renderExpression false
577-- "FALSE"
577-- "FALSE"
578−false :: Condition tables grouping params
578+false :: Condition relations grouping params
579false = UnsafeExpression "FALSE"
579false = UnsafeExpression "FALSE"
581-- | >>> renderExpression $ not_ true
581-- | >>> renderExpression $ not_ true
582-- "(NOT TRUE)"
582-- "(NOT TRUE)"
584− :: Condition tables grouping params
584+ :: Condition relations grouping params
585− -> Condition tables grouping params
585+ -> Condition relations grouping params
586not_ = unsafeUnaryOp "NOT"
586not_ = unsafeUnaryOp "NOT"
588-- | >>> renderExpression $ true .&& false
588-- | >>> renderExpression $ true .&& false
589-- "(TRUE AND FALSE)"
589-- "(TRUE AND FALSE)"
591− :: Condition tables grouping params
591+ :: Condition relations grouping params
592− -> Condition tables grouping params
592+ -> Condition relations grouping params
593− -> Condition tables grouping params
593+ -> Condition relations grouping params
594(.&&) = unsafeBinaryOp "AND"
594(.&&) = unsafeBinaryOp "AND"
596-- | >>> renderExpression $ true .|| false
596-- | >>> renderExpression $ true .|| false
597-- "(TRUE OR FALSE)"
597-- "(TRUE OR FALSE)"
599− :: Condition tables grouping params
599+ :: Condition relations grouping params
600− -> Condition tables grouping params
600+ -> Condition relations grouping params
601− -> Condition tables grouping params
601+ -> Condition relations grouping params
602(.||) = unsafeBinaryOp "OR"
602(.||) = unsafeBinaryOp "OR"
604-- | >>> :{
604-- | >>> :{
606−-- expression :: Expression tables grouping params (nullity 'PGint2)
606+-- expression :: Expression relations grouping params (nullity 'PGint2)
607-- expression = caseWhenThenElse [(true, 1), (false, 2)] 3
607-- expression = caseWhenThenElse [(true, 1), (false, 2)] 3
608-- in renderExpression expression
608-- in renderExpression expression
610-- "CASE WHEN TRUE THEN 1 WHEN FALSE THEN 2 ELSE 3 END"
610-- "CASE WHEN TRUE THEN 1 WHEN FALSE THEN 2 ELSE 3 END"
611caseWhenThenElse
611caseWhenThenElse
612− :: [ ( Condition tables grouping params
612+ :: [ ( Condition relations grouping params
613− , Expression tables grouping params (ty)
613+ , Expression relations grouping params (ty)
615− -> Expression tables grouping params (ty)
615+ -> Expression relations grouping params (ty)
616− -> Expression tables grouping params (ty)
616+ -> Expression relations grouping params (ty)
617caseWhenThenElse whenThens else_ = UnsafeExpression $ mconcat
617caseWhenThenElse whenThens else_ = UnsafeExpression $ mconcat
619 , mconcat
619 , mconcat
@@ -629,16 +629,16 @@ caseWhenThenElse whenThens else_ = UnsafeExpression $ mconcat
630-- | >>> :{
630-- | >>> :{
632−-- expression :: Expression tables grouping params (nullity 'PGint2)
632+-- expression :: Expression relations grouping params (nullity 'PGint2)
633-- expression = ifThenElse true 1 0
633-- expression = ifThenElse true 1 0
634-- in renderExpression expression
634-- in renderExpression expression
636-- "CASE WHEN TRUE THEN 1 ELSE 0 END"
636-- "CASE WHEN TRUE THEN 1 ELSE 0 END"
637ifThenElse
637ifThenElse
638− :: Condition tables grouping params
638+ :: Condition relations grouping params
639− -> Expression tables grouping params (ty)
639+ -> Expression relations grouping params (ty)
640− -> Expression tables grouping params (ty)
640+ -> Expression relations grouping params (ty)
641− -> Expression tables grouping params (ty)
641+ -> Expression relations grouping params (ty)
642ifThenElse if_ then_ else_ = caseWhenThenElse [(if_,then_)] else_
642ifThenElse if_ then_ else_ = caseWhenThenElse [(if_,then_)] else_
644-- | Comparison operations like `.==`, `./=`, `.>`, `.>=`, `.<` and `.<=`
644-- | Comparison operations like `.==`, `./=`, `.>`, `.>=`, `.<` and `.<=`
@@ -647,85 +647,85 @@ ifThenElse if_ then_ else_ = caseWhenThenElse [(if_,then_)] else_
647-- >>> renderExpression $ unNull true .== null_
647-- >>> renderExpression $ unNull true .== null_
648-- "(TRUE = NULL)"
648-- "(TRUE = NULL)"
650− :: Expression tables grouping params (nullity ty) -- ^ lhs
650+ :: Expression relations grouping params (nullity ty) -- ^ lhs
651− -> Expression tables grouping params (nullity ty) -- ^ rhs
651+ -> Expression relations grouping params (nullity ty) -- ^ rhs
652− -> Expression tables grouping params (nullity 'PGbool)
652+ -> Expression relations grouping params (nullity 'PGbool)
653(.==) = unsafeBinaryOp "="
653(.==) = unsafeBinaryOp "="
654infix 4 .==
654infix 4 .==
656-- | >>> renderExpression $ unNull true ./= null_
656-- | >>> renderExpression $ unNull true ./= null_
657-- "(TRUE <> NULL)"
657-- "(TRUE <> NULL)"
659− :: Expression tables grouping params (nullity ty) -- ^ lhs
659+ :: Expression relations grouping params (nullity ty) -- ^ lhs
660− -> Expression tables grouping params (nullity ty) -- ^ rhs
660+ -> Expression relations grouping params (nullity ty) -- ^ rhs
661− -> Expression tables grouping params (nullity 'PGbool)
661+ -> Expression relations grouping params (nullity 'PGbool)
662(./=) = unsafeBinaryOp "<>"
662(./=) = unsafeBinaryOp "<>"
663infix 4 ./=
663infix 4 ./=
665-- | >>> renderExpression $ unNull true .>= null_
665-- | >>> renderExpression $ unNull true .>= null_
666-- "(TRUE >= NULL)"
666-- "(TRUE >= NULL)"
668− :: Expression tables grouping params (nullity ty) -- ^ lhs
668+ :: Expression relations grouping params (nullity ty) -- ^ lhs
669− -> Expression tables grouping params (nullity ty) -- ^ rhs
669+ -> Expression relations grouping params (nullity ty) -- ^ rhs
670− -> Expression tables grouping params (nullity 'PGbool)
670+ -> Expression relations grouping params (nullity 'PGbool)
671(.>=) = unsafeBinaryOp ">="
671(.>=) = unsafeBinaryOp ">="
672infix 4 .>=
672infix 4 .>=
674-- | >>> renderExpression $ unNull true .< null_
674-- | >>> renderExpression $ unNull true .< null_
675-- "(TRUE < NULL)"
675-- "(TRUE < NULL)"
677− :: Expression tables grouping params (nullity ty) -- ^ lhs
677+ :: Expression relations grouping params (nullity ty) -- ^ lhs
678− -> Expression tables grouping params (nullity ty) -- ^ rhs
678+ -> Expression relations grouping params (nullity ty) -- ^ rhs
679− -> Expression tables grouping params (nullity 'PGbool)
679+ -> Expression relations grouping params (nullity 'PGbool)
680(.<) = unsafeBinaryOp "<"
680(.<) = unsafeBinaryOp "<"
681infix 4 .<
681infix 4 .<
683-- | >>> renderExpression $ unNull true .<= null_
683-- | >>> renderExpression $ unNull true .<= null_
684-- "(TRUE <= NULL)"
684-- "(TRUE <= NULL)"
686− :: Expression tables grouping params (nullity ty) -- ^ lhs
686+ :: Expression relations grouping params (nullity ty) -- ^ lhs
687− -> Expression tables grouping params (nullity ty) -- ^ rhs
687+ -> Expression relations grouping params (nullity ty) -- ^ rhs
688− -> Expression tables grouping params (nullity 'PGbool)
688+ -> Expression relations grouping params (nullity 'PGbool)
689(.<=) = unsafeBinaryOp "<="
689(.<=) = unsafeBinaryOp "<="
690infix 4 .<=
690infix 4 .<=
692-- | >>> renderExpression $ unNull true .> null_
692-- | >>> renderExpression $ unNull true .> null_
693-- "(TRUE > NULL)"
693-- "(TRUE > NULL)"
695− :: Expression tables grouping params (nullity ty) -- ^ lhs
695+ :: Expression relations grouping params (nullity ty) -- ^ lhs
696− -> Expression tables grouping params (nullity ty) -- ^ rhs
696+ -> Expression relations grouping params (nullity ty) -- ^ rhs
697− -> Expression tables grouping params (nullity 'PGbool)
697+ -> Expression relations grouping params (nullity 'PGbool)
698(.>) = unsafeBinaryOp ">"
698(.>) = unsafeBinaryOp ">"
699infix 4 .>
699infix 4 .>
701-- | >>> renderExpression $ currentDate
701-- | >>> renderExpression $ currentDate
702-- "CURRENT_DATE"
702-- "CURRENT_DATE"
703currentDate
703currentDate
704− :: Expression tables grouping params (nullity 'PGdate)
704+ :: Expression relations grouping params (nullity 'PGdate)
705currentDate = UnsafeExpression "CURRENT_DATE"
705currentDate = UnsafeExpression "CURRENT_DATE"
707-- | >>> renderExpression $ currentTime
707-- | >>> renderExpression $ currentTime
708-- "CURRENT_TIME"
708-- "CURRENT_TIME"
709currentTime
709currentTime
710− :: Expression tables grouping params (nullity 'PGtimetz)
710+ :: Expression relations grouping params (nullity 'PGtimetz)
711currentTime = UnsafeExpression "CURRENT_TIME"
711currentTime = UnsafeExpression "CURRENT_TIME"
713-- | >>> renderExpression $ currentTimestamp
713-- | >>> renderExpression $ currentTimestamp
714-- "CURRENT_TIMESTAMP"
714-- "CURRENT_TIMESTAMP"
715currentTimestamp
715currentTimestamp
716− :: Expression tables grouping params (nullity 'PGtimestamptz)
716+ :: Expression relations grouping params (nullity 'PGtimestamptz)
717currentTimestamp = UnsafeExpression "CURRENT_TIMESTAMP"
717currentTimestamp = UnsafeExpression "CURRENT_TIMESTAMP"
719-- | >>> renderExpression $ localTime
719-- | >>> renderExpression $ localTime
720-- "LOCALTIME"
720-- "LOCALTIME"
722− :: Expression tables grouping params (nullity 'PGtime)
722+ :: Expression relations grouping params (nullity 'PGtime)
723localTime = UnsafeExpression "LOCALTIME"
723localTime = UnsafeExpression "LOCALTIME"
725-- | >>> renderExpression $ localTimestamp
725-- | >>> renderExpression $ localTimestamp
726-- "LOCALTIMESTAMP"
726-- "LOCALTIMESTAMP"
727localTimestamp
727localTimestamp
728− :: Expression tables grouping params (nullity 'PGtimestamp)
728+ :: Expression relations grouping params (nullity 'PGtimestamp)
729localTimestamp = UnsafeExpression "LOCALTIMESTAMP"
729localTimestamp = UnsafeExpression "LOCALTIMESTAMP"
731{-----------------------------------------
731{-----------------------------------------
@@ -733,7 +733,7 @@ text
733-----------------------------------------}
733-----------------------------------------}
735instance IsString
735instance IsString
736− (Expression tables grouping params (nullity 'PGtext)) where
736+ (Expression relations grouping params (nullity 'PGtext)) where
737 fromString str = UnsafeExpression $
737 fromString str = UnsafeExpression $
738 "E\'" <> fromString (escape =<< str) <> "\'"
738 "E\'" <> fromString (escape =<< str) <> "\'"
@@ -749,32 +749,32 @@ instance IsString
751instance Monoid
751instance Monoid
752− (Expression tables grouping params (nullity 'PGtext)) where
752+ (Expression relations grouping params (nullity 'PGtext)) where
753 mempty = fromString ""
753 mempty = fromString ""
754 mappend = unsafeBinaryOp "||"
754 mappend = unsafeBinaryOp "||"
756-- | >>> renderExpression $ lower "ARRRGGG"
756-- | >>> renderExpression $ lower "ARRRGGG"
757-- "lower(E'ARRRGGG')"
757-- "lower(E'ARRRGGG')"
759− :: Expression tables grouping params (nullity 'PGtext)
759+ :: Expression relations grouping params (nullity 'PGtext)
760 -- ^ string to lower case
760 -- ^ string to lower case
761− -> Expression tables grouping params (nullity 'PGtext)
761+ -> Expression relations grouping params (nullity 'PGtext)
762lower = unsafeFunction "lower"
762lower = unsafeFunction "lower"
764-- | >>> renderExpression $ upper "eeee"
764-- | >>> renderExpression $ upper "eeee"
765-- "upper(E'eeee')"
765-- "upper(E'eeee')"
767− :: Expression tables grouping params (nullity 'PGtext)
767+ :: Expression relations grouping params (nullity 'PGtext)
768 -- ^ string to upper case
768 -- ^ string to upper case
769− -> Expression tables grouping params (nullity 'PGtext)
769+ -> Expression relations grouping params (nullity 'PGtext)
770upper = unsafeFunction "upper"
770upper = unsafeFunction "upper"
772-- | >>> renderExpression $ charLength "four"
772-- | >>> renderExpression $ charLength "four"
773-- "char_length(E'four')"
773-- "char_length(E'four')"
774charLength
774charLength
775− :: Expression tables grouping params (nullity 'PGtext)
775+ :: Expression relations grouping params (nullity 'PGtext)
776 -- ^ string to measure
776 -- ^ string to measure
777− -> Expression tables grouping params (nullity 'PGint4)
777+ -> Expression relations grouping params (nullity 'PGint4)
778charLength = unsafeFunction "char_length"
778charLength = unsafeFunction "char_length"
780-- | The `like` expression returns true if the @string@ matches
780-- | The `like` expression returns true if the @string@ matches
@@ -787,11 +787,11 @@ charLength = unsafeFunction "char_length"
787-- >>> renderExpression $ "abc" `like` "a%"
787-- >>> renderExpression $ "abc" `like` "a%"
788-- "(E'abc' LIKE E'a%')"
788-- "(E'abc' LIKE E'a%')"
790− :: Expression tables grouping params (nullity 'PGtext)
790+ :: Expression relations grouping params (nullity 'PGtext)
791 -- ^ string
791 -- ^ string
792− -> Expression tables grouping params (nullity 'PGtext)
792+ -> Expression relations grouping params (nullity 'PGtext)
793 -- ^ pattern
793 -- ^ pattern
794− -> Expression tables grouping params (nullity 'PGbool)
794+ -> Expression relations grouping params (nullity 'PGbool)
795like = unsafeBinaryOp "LIKE"
795like = unsafeBinaryOp "LIKE"
797{-----------------------------------------
797{-----------------------------------------
@@ -801,16 +801,16 @@ aggregation
801-- | escape hatch to define aggregate functions
801-- | escape hatch to define aggregate functions
802unsafeAggregate
802unsafeAggregate
803 :: ByteString -- ^ aggregate function
803 :: ByteString -- ^ aggregate function
804− -> Expression tables 'Ungrouped params (xty)
804+ -> Expression relations 'Ungrouped params (xty)
805− -> Expression tables ('Grouped bys) params (yty)
805+ -> Expression relations ('Grouped bys) params (yty)
806unsafeAggregate fun x = UnsafeExpression $ mconcat
806unsafeAggregate fun x = UnsafeExpression $ mconcat
807 [fun, "(", renderExpression x, ")"]
807 [fun, "(", renderExpression x, ")"]
809-- | escape hatch to define aggregate functions over distinct values
809-- | escape hatch to define aggregate functions over distinct values
810unsafeAggregateDistinct
810unsafeAggregateDistinct
811 :: ByteString -- ^ aggregate function
811 :: ByteString -- ^ aggregate function
812− -> Expression tables 'Ungrouped params (xty)
812+ -> Expression relations 'Ungrouped params (xty)
813− -> Expression tables ('Grouped bys) params (yty)
813+ -> Expression relations ('Grouped bys) params (yty)
814unsafeAggregateDistinct fun x = UnsafeExpression $ mconcat
814unsafeAggregateDistinct fun x = UnsafeExpression $ mconcat
815 [fun, "(DISTINCT ", renderExpression x, ")"]
815 [fun, "(DISTINCT ", renderExpression x, ")"]
@@ -823,9 +823,9 @@ unsafeAggregateDistinct fun x = UnsafeExpression $ mconcat
823-- "sum(col)"
823-- "sum(col)"
825 :: PGNum ty
825 :: PGNum ty
826− => Expression tables 'Ungrouped params (nullity ty)
826+ => Expression relations 'Ungrouped params (nullity ty)
827 -- ^ what to sum
827 -- ^ what to sum
828− -> Expression tables ('Grouped bys) params (nullity ty)
828+ -> Expression relations ('Grouped bys) params (nullity ty)
829sum_ = unsafeAggregate "sum"
829sum_ = unsafeAggregate "sum"
831-- | >>> :{
831-- | >>> :{
@@ -837,18 +837,18 @@ sum_ = unsafeAggregate "sum"
837-- "sum(DISTINCT col)"
837-- "sum(DISTINCT col)"
838sumDistinct
838sumDistinct
839 :: PGNum ty
839 :: PGNum ty
840− => Expression tables 'Ungrouped params (nullity ty)
840+ => Expression relations 'Ungrouped params (nullity ty)
841 -- ^ what to sum
841 -- ^ what to sum
842− -> Expression tables ('Grouped bys) params (nullity ty)
842+ -> Expression relations ('Grouped bys) params (nullity ty)
843sumDistinct = unsafeAggregateDistinct "sum"
843sumDistinct = unsafeAggregateDistinct "sum"
845-- | A constraint for `PGType`s that you can take averages of and the resulting
845-- | A constraint for `PGType`s that you can take averages of and the resulting
846-- `PGType`.
846-- `PGType`.
847class PGAvg ty avg | ty -> avg where
847class PGAvg ty avg | ty -> avg where
848 avg, avgDistinct
848 avg, avgDistinct
849− :: Expression tables 'Ungrouped params (nullity ty)
849+ :: Expression relations 'Ungrouped params (nullity ty)
850 -- ^ what to average
850 -- ^ what to average
851− -> Expression tables ('Grouped bys) params (nullity avg)
851+ -> Expression relations ('Grouped bys) params (nullity avg)
852 avg = unsafeAggregate "avg"
852 avg = unsafeAggregate "avg"
853 avgDistinct = unsafeAggregateDistinct "avg"
853 avgDistinct = unsafeAggregateDistinct "avg"
854instance PGAvg 'PGint2 'PGnumeric
854instance PGAvg 'PGint2 'PGnumeric
@@ -868,9 +868,9 @@ instance PGAvg 'PGinterval 'PGinterval
868-- "bit_and(col)"
868-- "bit_and(col)"
870 :: PGIntegral int
870 :: PGIntegral int
871− => Expression tables 'Ungrouped params (nullity int)
871+ => Expression relations 'Ungrouped params (nullity int)
872 -- ^ what to aggregate
872 -- ^ what to aggregate
873− -> Expression tables ('Grouped bys) params (nullity int)
873+ -> Expression relations ('Grouped bys) params (nullity int)
874bitAnd = unsafeAggregate "bit_and"
874bitAnd = unsafeAggregate "bit_and"
876-- | >>> :{
876-- | >>> :{
@@ -882,9 +882,9 @@ bitAnd = unsafeAggregate "bit_and"
882-- "bit_or(col)"
882-- "bit_or(col)"
884 :: PGIntegral int
884 :: PGIntegral int
885− => Expression tables 'Ungrouped params (nullity int)
885+ => Expression relations 'Ungrouped params (nullity int)
886 -- ^ what to aggregate
886 -- ^ what to aggregate
887− -> Expression tables ('Grouped bys) params (nullity int)
887+ -> Expression relations ('Grouped bys) params (nullity int)
888bitOr = unsafeAggregate "bit_or"
888bitOr = unsafeAggregate "bit_or"
890-- | >>> :{
890-- | >>> :{
@@ -896,9 +896,9 @@ bitOr = unsafeAggregate "bit_or"
896-- "bit_and(DISTINCT col)"
896-- "bit_and(DISTINCT col)"
897bitAndDistinct
897bitAndDistinct
898 :: PGIntegral int
898 :: PGIntegral int
899− => Expression tables 'Ungrouped params (nullity int)
899+ => Expression relations 'Ungrouped params (nullity int)
900 -- ^ what to aggregate
900 -- ^ what to aggregate
901− -> Expression tables ('Grouped bys) params (nullity int)
901+ -> Expression relations ('Grouped bys) params (nullity int)
902bitAndDistinct = unsafeAggregateDistinct "bit_and"
902bitAndDistinct = unsafeAggregateDistinct "bit_and"
904-- | >>> :{
904-- | >>> :{
@@ -910,9 +910,9 @@ bitAndDistinct = unsafeAggregateDistinct "bit_and"
910-- "bit_or(DISTINCT col)"
910-- "bit_or(DISTINCT col)"
911bitOrDistinct
911bitOrDistinct
912 :: PGIntegral int
912 :: PGIntegral int
913− => Expression tables 'Ungrouped params (nullity int)
913+ => Expression relations 'Ungrouped params (nullity int)
914 -- ^ what to aggregate
914 -- ^ what to aggregate
915− -> Expression tables ('Grouped bys) params (nullity int)
915+ -> Expression relations ('Grouped bys) params (nullity int)
916bitOrDistinct = unsafeAggregateDistinct "bit_or"
916bitOrDistinct = unsafeAggregateDistinct "bit_or"
918-- | >>> :{
918-- | >>> :{
@@ -923,9 +923,9 @@ bitOrDistinct = unsafeAggregateDistinct "bit_or"
924-- "bool_and(col)"
924-- "bool_and(col)"
926− :: Expression tables 'Ungrouped params (nullity 'PGbool)
926+ :: Expression relations 'Ungrouped params (nullity 'PGbool)
927 -- ^ what to aggregate
927 -- ^ what to aggregate
928− -> Expression tables ('Grouped bys) params (nullity 'PGbool)
928+ -> Expression relations ('Grouped bys) params (nullity 'PGbool)
929boolAnd = unsafeAggregate "bool_and"
929boolAnd = unsafeAggregate "bool_and"
931-- | >>> :{
931-- | >>> :{
@@ -936,9 +936,9 @@ boolAnd = unsafeAggregate "bool_and"
937-- "bool_or(col)"
937-- "bool_or(col)"
939− :: Expression tables 'Ungrouped params (nullity 'PGbool)
939+ :: Expression relations 'Ungrouped params (nullity 'PGbool)
940 -- ^ what to aggregate
940 -- ^ what to aggregate
941− -> Expression tables ('Grouped bys) params (nullity 'PGbool)
941+ -> Expression relations ('Grouped bys) params (nullity 'PGbool)
942boolOr = unsafeAggregate "bool_or"
942boolOr = unsafeAggregate "bool_or"
944-- | >>> :{
944-- | >>> :{
@@ -949,9 +949,9 @@ boolOr = unsafeAggregate "bool_or"
950-- "bool_and(DISTINCT col)"
950-- "bool_and(DISTINCT col)"
951boolAndDistinct
951boolAndDistinct
952− :: Expression tables 'Ungrouped params (nullity 'PGbool)
952+ :: Expression relations 'Ungrouped params (nullity 'PGbool)
953 -- ^ what to aggregate
953 -- ^ what to aggregate
954− -> Expression tables ('Grouped bys) params (nullity 'PGbool)
954+ -> Expression relations ('Grouped bys) params (nullity 'PGbool)
955boolAndDistinct = unsafeAggregateDistinct "bool_and"
955boolAndDistinct = unsafeAggregateDistinct "bool_and"
957-- | >>> :{
957-- | >>> :{
@@ -962,9 +962,9 @@ boolAndDistinct = unsafeAggregateDistinct "bool_and"
963-- "bool_or(DISTINCT col)"
963-- "bool_or(DISTINCT col)"
964boolOrDistinct
964boolOrDistinct
965− :: Expression tables 'Ungrouped params (nullity 'PGbool)
965+ :: Expression relations 'Ungrouped params (nullity 'PGbool)
966 -- ^ what to aggregate
966 -- ^ what to aggregate
967− -> Expression tables ('Grouped bys) params (nullity 'PGbool)
967+ -> Expression relations ('Grouped bys) params (nullity 'PGbool)
968boolOrDistinct = unsafeAggregateDistinct "bool_or"
968boolOrDistinct = unsafeAggregateDistinct "bool_or"
970-- | A special aggregation that does not require an input
970-- | A special aggregation that does not require an input
@@ -972,7 +972,7 @@ boolOrDistinct = unsafeAggregateDistinct "bool_or"
972-- >>> renderExpression countStar
972-- >>> renderExpression countStar
973-- "count(*)"
973-- "count(*)"
975− :: Expression tables ('Grouped bys) params ('NotNull 'PGint8)
975+ :: Expression relations ('Grouped bys) params ('NotNull 'PGint8)
976countStar = UnsafeExpression $ "count(*)"
976countStar = UnsafeExpression $ "count(*)"
978-- | >>> :{
978-- | >>> :{
@@ -983,9 +983,9 @@ countStar = UnsafeExpression $ "count(*)"
984-- "count(col)"
984-- "count(col)"
986− :: Expression tables 'Ungrouped params ty
986+ :: Expression relations 'Ungrouped params ty
987 -- ^ what to count
987 -- ^ what to count
988− -> Expression tables ('Grouped bys) params ('NotNull 'PGint8)
988+ -> Expression relations ('Grouped bys) params ('NotNull 'PGint8)
989count = unsafeAggregate "count"
989count = unsafeAggregate "count"
991-- | >>> :{
991-- | >>> :{
@@ -996,9 +996,9 @@ count = unsafeAggregate "count"
997-- "count(DISTINCT col)"
997-- "count(DISTINCT col)"
998countDistinct
998countDistinct
999− :: Expression tables 'Ungrouped params ty
999+ :: Expression relations 'Ungrouped params ty
1000 -- ^ what to count
1000 -- ^ what to count
1001− -> Expression tables ('Grouped bys) params ('NotNull 'PGint8)
1001+ -> Expression relations ('Grouped bys) params ('NotNull 'PGint8)
1002countDistinct = unsafeAggregateDistinct "count"
1002countDistinct = unsafeAggregateDistinct "count"
1004-- | synonym for `boolAnd`
1004-- | synonym for `boolAnd`
@@ -1011,9 +1011,9 @@ countDistinct = unsafeAggregateDistinct "count"
1012-- "every(col)"
1012-- "every(col)"
1014− :: Expression tables 'Ungrouped params (nullity 'PGbool)
1014+ :: Expression relations 'Ungrouped params (nullity 'PGbool)
1015 -- ^ what to aggregate
1015 -- ^ what to aggregate
1016− -> Expression tables ('Grouped bys) params (nullity 'PGbool)
1016+ -> Expression relations ('Grouped bys) params (nullity 'PGbool)
1017every = unsafeAggregate "every"
1017every = unsafeAggregate "every"
1019-- | synonym for `boolAndDistinct`
1019-- | synonym for `boolAndDistinct`
@@ -1026,16 +1026,16 @@ every = unsafeAggregate "every"
1027-- "every(DISTINCT col)"
1027-- "every(DISTINCT col)"
1028everyDistinct
1028everyDistinct
1029− :: Expression tables 'Ungrouped params (nullity 'PGbool)
1029+ :: Expression relations 'Ungrouped params (nullity 'PGbool)
1030 -- ^ what to aggregate
1030 -- ^ what to aggregate
1031− -> Expression tables ('Grouped bys) params (nullity 'PGbool)
1031+ -> Expression relations ('Grouped bys) params (nullity 'PGbool)
1032everyDistinct = unsafeAggregateDistinct "every"
1032everyDistinct = unsafeAggregateDistinct "every"
1034-- | minimum and maximum aggregation
1034-- | minimum and maximum aggregation
1035max_, min_, maxDistinct, minDistinct
1035max_, min_, maxDistinct, minDistinct
1036− :: Expression tables 'Ungrouped params (nullity ty)
1036+ :: Expression relations 'Ungrouped params (nullity ty)
1037 -- ^ what to aggregate
1037 -- ^ what to aggregate
1038− -> Expression tables ('Grouped bys) params (nullity ty)
1038+ -> Expression relations ('Grouped bys) params (nullity ty)
1039max_ = unsafeAggregate "max"
1039max_ = unsafeAggregate "max"
1040min_ = unsafeAggregate "min"
1040min_ = unsafeAggregate "min"
1041maxDistinct = unsafeAggregateDistinct "max"
1041maxDistinct = unsafeAggregateDistinct "max"