| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Rel8.Internal.Expr.Aggregate
Synopsis
- count :: forall (fold :: Fold) a. Aggregator' fold (Expr a) (Expr Int64)
- countOn :: forall i a (fold :: Fold). (i -> Expr a) -> Aggregator' fold i (Expr Int64)
- countStar :: forall (fold :: Fold) i. Aggregator' fold i (Expr Int64)
- countDistinct :: forall a (fold :: Fold). Sql DBEq a => Aggregator' fold (Expr a) (Expr Int64)
- countDistinctOn :: forall a i (fold :: Fold). Sql DBEq a => (i -> Expr a) -> Aggregator' fold i (Expr Int64)
- countWhere :: forall (fold :: Fold). Aggregator' fold (Expr Bool) (Expr Int64)
- countWhereOn :: forall i (fold :: Fold). (i -> Expr Bool) -> Aggregator' fold i (Expr Int64)
- and :: forall (fold :: Fold). Aggregator' fold (Expr Bool) (Expr Bool)
- andOn :: forall i (fold :: Fold). (i -> Expr Bool) -> Aggregator' fold i (Expr Bool)
- or :: forall (fold :: Fold). Aggregator' fold (Expr Bool) (Expr Bool)
- orOn :: forall i (fold :: Fold). (i -> Expr Bool) -> Aggregator' fold i (Expr Bool)
- min :: Sql DBMin a => Aggregator1 (Expr a) (Expr a)
- minOn :: Sql DBMin a => (i -> Expr a) -> Aggregator1 i (Expr a)
- max :: Sql DBMax a => Aggregator1 (Expr a) (Expr a)
- maxOn :: Sql DBMax a => (i -> Expr a) -> Aggregator1 i (Expr a)
- sum :: forall a (fold :: Fold). (Sql DBNum a, Sql DBSum a) => Aggregator' fold (Expr a) (Expr a)
- sumOn :: forall a i (fold :: Fold). (Sql DBNum a, Sql DBSum a) => (i -> Expr a) -> Aggregator' fold i (Expr a)
- sumWhere :: forall a i (fold :: Fold). (Sql DBNum a, Sql DBSum a) => (i -> Expr Bool) -> (i -> Expr a) -> Aggregator' fold i (Expr a)
- avg :: Sql DBSum a => Aggregator1 (Expr a) (Expr a)
- avgOn :: Sql DBSum a => (i -> Expr a) -> Aggregator1 i (Expr a)
- stringAgg :: forall a (fold :: Fold). (Sql IsString a, Sql DBString a) => Expr a -> Aggregator' fold (Expr a) (Expr a)
- stringAggOn :: forall a i (fold :: Fold). (Sql IsString a, Sql DBString a) => Expr a -> (i -> Expr a) -> Aggregator' fold i (Expr a)
- mode :: Sql DBOrd a => Aggregator1 (Expr a) (Expr a)
- modeOn :: Sql DBOrd a => (i -> Expr a) -> Aggregator1 i (Expr a)
- percentile :: Sql DBOrd a => Expr Double -> Aggregator1 (Expr a) (Expr a)
- percentileOn :: Sql DBOrd a => Expr Double -> (i -> Expr a) -> Aggregator1 i (Expr a)
- percentileContinuous :: Sql DBFractional a => Expr Double -> Aggregator1 (Expr a) (Expr a)
- percentileContinuousOn :: Sql DBFractional a => Expr Double -> (i -> Expr a) -> Aggregator1 i (Expr a)
- hypotheticalRank :: forall a (fold :: Fold). Order a -> a -> Aggregator' fold a (Expr Int64)
- hypotheticalDenseRank :: forall a (fold :: Fold). Order a -> a -> Aggregator' fold a (Expr Int64)
- hypotheticalPercentRank :: forall a (fold :: Fold). Order a -> a -> Aggregator' fold a (Expr Double)
- hypotheticalCumeDist :: forall a (fold :: Fold). Order a -> a -> Aggregator' fold a (Expr Double)
- groupByExpr :: Sql DBEq a => Aggregator1 (Expr a) (Expr a)
- groupByExprOn :: Sql DBEq a => (i -> Expr a) -> Aggregator1 i (Expr a)
- distinctAggregate :: forall (fold :: Fold) i a. Aggregator' fold i a -> Aggregator' fold i a
- filterWhereExplicit :: forall a i (fold :: Fold). IfPP a a -> (i -> Expr Bool) -> Aggregator i a -> Aggregator' fold i a
- listAggExpr :: forall a (fold :: Fold). Sql DBType a => Aggregator' fold (Expr a) (Expr [a])
- listAggExprOn :: forall a i (fold :: Fold). Sql DBType a => (i -> Expr a) -> Aggregator' fold i (Expr [a])
- nonEmptyAggExpr :: Sql DBType a => Aggregator1 (Expr a) (Expr (NonEmpty a))
- nonEmptyAggExprOn :: Sql DBType a => (i -> Expr a) -> Aggregator1 i (Expr (NonEmpty a))
- listCatExpr :: forall a (fold :: Fold). Sql DBType a => Aggregator' fold (Expr [a]) (Expr [a])
- listCatExprOn :: forall a i (fold :: Fold). Sql DBType a => (i -> Expr [a]) -> Aggregator' fold i (Expr [a])
- nonEmptyCatExpr :: Sql DBType a => Aggregator1 (Expr (NonEmpty a)) (Expr (NonEmpty a))
- nonEmptyCatExprOn :: Sql DBType a => (i -> Expr (NonEmpty a)) -> Aggregator1 i (Expr (NonEmpty a))
- slistAggExpr :: forall a (fold :: Fold). TypeInformation (Unnullify a) -> Aggregator' fold (Expr a) (Expr [a])
- snonEmptyAggExpr :: TypeInformation (Unnullify a) -> Aggregator1 (Expr a) (Expr (NonEmpty a))
- slistCatExpr :: forall a (fold :: Fold). TypeInformation (Unnullify a) -> Aggregator' fold (Expr [a]) (Expr [a])
- snonEmptyCatExpr :: TypeInformation (Unnullify a) -> Aggregator1 (Expr (NonEmpty a)) (Expr (NonEmpty a))
Documentation
count :: forall (fold :: Fold) a. Aggregator' fold (Expr a) (Expr Int64) Source #
Count the occurances of a single column. Corresponds to COUNT(a)
countOn :: forall i a (fold :: Fold). (i -> Expr a) -> Aggregator' fold i (Expr Int64) Source #
Applies count to the column selected by the given function.
countStar :: forall (fold :: Fold) i. Aggregator' fold i (Expr Int64) Source #
Corresponds to COUNT(*).
countDistinct :: forall a (fold :: Fold). Sql DBEq a => Aggregator' fold (Expr a) (Expr Int64) Source #
Count the number of distinct occurrences of a single column. Corresponds to
COUNT(DISTINCT a)
countDistinctOn :: forall a i (fold :: Fold). Sql DBEq a => (i -> Expr a) -> Aggregator' fold i (Expr Int64) Source #
Applies countDistinct to the column selected by the given function.
countWhere :: forall (fold :: Fold). Aggregator' fold (Expr Bool) (Expr Int64) Source #
A count of the number of times a given expression is true.
countWhereOn :: forall i (fold :: Fold). (i -> Expr Bool) -> Aggregator' fold i (Expr Int64) Source #
Applies countWhere to the column selected by the given function.
and :: forall (fold :: Fold). Aggregator' fold (Expr Bool) (Expr Bool) Source #
Corresponds to bool_and.
andOn :: forall i (fold :: Fold). (i -> Expr Bool) -> Aggregator' fold i (Expr Bool) Source #
Applies and to the column selected by the given function.
or :: forall (fold :: Fold). Aggregator' fold (Expr Bool) (Expr Bool) Source #
Corresponds to bool_or.
orOn :: forall i (fold :: Fold). (i -> Expr Bool) -> Aggregator' fold i (Expr Bool) Source #
Applies or to the column selected by the given function.
min :: Sql DBMin a => Aggregator1 (Expr a) (Expr a) Source #
Produce an aggregation for Expr a using the min function.
minOn :: Sql DBMin a => (i -> Expr a) -> Aggregator1 i (Expr a) Source #
Applies min to the column selected by the given function.
max :: Sql DBMax a => Aggregator1 (Expr a) (Expr a) Source #
Produce an aggregation for Expr a using the max function.
maxOn :: Sql DBMax a => (i -> Expr a) -> Aggregator1 i (Expr a) Source #
Applies max to the column selected by the given function.
sum :: forall a (fold :: Fold). (Sql DBNum a, Sql DBSum a) => Aggregator' fold (Expr a) (Expr a) Source #
Corresponds to sum. Note that in SQL, sum is type changing - for
example the sum of integer returns a bigint. Rel8 doesn't support
this, and will add explicit casts back to the original input type. This can
lead to overflows, and if you anticipate very large sums, you should upcast
your input.
sumOn :: forall a i (fold :: Fold). (Sql DBNum a, Sql DBSum a) => (i -> Expr a) -> Aggregator' fold i (Expr a) Source #
Applies sum to the column selected by the given fucntion.
sumWhere :: forall a i (fold :: Fold). (Sql DBNum a, Sql DBSum a) => (i -> Expr Bool) -> (i -> Expr a) -> Aggregator' fold i (Expr a) Source #
sumWhere is a combination of filterWhere and sumOn.
avg :: Sql DBSum a => Aggregator1 (Expr a) (Expr a) Source #
Corresponds to avg. Note that in SQL, avg is type changing - for
example, the avg of integer returns a numeric. Rel8 doesn't support
this, and will add explicit casts back to the original input type. If you
need a fractional result on an integral column, you should cast your input
to Double or Scientific before calling avg.
avgOn :: Sql DBSum a => (i -> Expr a) -> Aggregator1 i (Expr a) Source #
Applies avg to the column selected by the given fucntion.
stringAgg :: forall a (fold :: Fold). (Sql IsString a, Sql DBString a) => Expr a -> Aggregator' fold (Expr a) (Expr a) Source #
Corresponds to string_agg().
stringAggOn :: forall a i (fold :: Fold). (Sql IsString a, Sql DBString a) => Expr a -> (i -> Expr a) -> Aggregator' fold i (Expr a) Source #
Applies stringAgg to the column selected by the given function.
mode :: Sql DBOrd a => Aggregator1 (Expr a) (Expr a) Source #
Corresponds to mode() WITHIN GROUP (ORDER BY _).
modeOn :: Sql DBOrd a => (i -> Expr a) -> Aggregator1 i (Expr a) Source #
Applies mode to the column selected by the given function.
percentile :: Sql DBOrd a => Expr Double -> Aggregator1 (Expr a) (Expr a) Source #
Corresponds to percentile_disc(_) WITHIN GROUP (ORDER BY _).
percentileOn :: Sql DBOrd a => Expr Double -> (i -> Expr a) -> Aggregator1 i (Expr a) Source #
Applies percentile to the column selected by the given function.
percentileContinuous :: Sql DBFractional a => Expr Double -> Aggregator1 (Expr a) (Expr a) Source #
Corresponds to percentile_cont(_) WITHIN GROUP (ORDER BY _).
percentileContinuousOn :: Sql DBFractional a => Expr Double -> (i -> Expr a) -> Aggregator1 i (Expr a) Source #
Applies percentileContinuous to the column selected by the given
function.
hypotheticalRank :: forall a (fold :: Fold). Order a -> a -> Aggregator' fold a (Expr Int64) Source #
Corresponds to rank(_) WITHIN GROUP (ORDER BY _).
hypotheticalDenseRank :: forall a (fold :: Fold). Order a -> a -> Aggregator' fold a (Expr Int64) Source #
Corresponds to dense_rank(_) WITHIN GROUP (ORDER BY _).
hypotheticalPercentRank :: forall a (fold :: Fold). Order a -> a -> Aggregator' fold a (Expr Double) Source #
Corresponds to percent_rank(_) WITHIN GROUP (ORDER BY _).
hypotheticalCumeDist :: forall a (fold :: Fold). Order a -> a -> Aggregator' fold a (Expr Double) Source #
Corresponds to cume_dist(_) WITHIN GROUP (ORDER BY _).
groupByExpr :: Sql DBEq a => Aggregator1 (Expr a) (Expr a) Source #
Aggregate a value by grouping by it.
groupByExprOn :: Sql DBEq a => (i -> Expr a) -> Aggregator1 i (Expr a) Source #
Applies groupByExpr to the column selected by the given function.
distinctAggregate :: forall (fold :: Fold) i a. Aggregator' fold i a -> Aggregator' fold i a Source #
distinctAggregate modifies an Aggregator to consider only distinct
values of each particular column. Note that this "distinction" only happens
within each column individually, not across all columns simultaneously.
filterWhereExplicit :: forall a i (fold :: Fold). IfPP a a -> (i -> Expr Bool) -> Aggregator i a -> Aggregator' fold i a Source #
listAggExpr :: forall a (fold :: Fold). Sql DBType a => Aggregator' fold (Expr a) (Expr [a]) Source #
Collect expressions values as a list.
listAggExprOn :: forall a i (fold :: Fold). Sql DBType a => (i -> Expr a) -> Aggregator' fold i (Expr [a]) Source #
Applies listAggExpr to the column selected by the given function.
nonEmptyAggExpr :: Sql DBType a => Aggregator1 (Expr a) (Expr (NonEmpty a)) Source #
Collect expressions values as a non-empty list.
nonEmptyAggExprOn :: Sql DBType a => (i -> Expr a) -> Aggregator1 i (Expr (NonEmpty a)) Source #
Applies nonEmptyAggExpr to the column selected by the given function.
listCatExpr :: forall a (fold :: Fold). Sql DBType a => Aggregator' fold (Expr [a]) (Expr [a]) Source #
Concatenate lists into a single list.
listCatExprOn :: forall a i (fold :: Fold). Sql DBType a => (i -> Expr [a]) -> Aggregator' fold i (Expr [a]) Source #
Applies listCatExpr to the column selected by the given function.
nonEmptyCatExpr :: Sql DBType a => Aggregator1 (Expr (NonEmpty a)) (Expr (NonEmpty a)) Source #
Concatenate non-empty lists into a single non-empty list.
nonEmptyCatExprOn :: Sql DBType a => (i -> Expr (NonEmpty a)) -> Aggregator1 i (Expr (NonEmpty a)) Source #
Applies nonEmptyCatExpr to the column selected by the given function.
slistAggExpr :: forall a (fold :: Fold). TypeInformation (Unnullify a) -> Aggregator' fold (Expr a) (Expr [a]) Source #
snonEmptyAggExpr :: TypeInformation (Unnullify a) -> Aggregator1 (Expr a) (Expr (NonEmpty a)) Source #
slistCatExpr :: forall a (fold :: Fold). TypeInformation (Unnullify a) -> Aggregator' fold (Expr [a]) (Expr [a]) Source #
snonEmptyCatExpr :: TypeInformation (Unnullify a) -> Aggregator1 (Expr (NonEmpty a)) (Expr (NonEmpty a)) Source #