Portability | unknown |
---|---|

Stability | experimental |

Maintainer | ex8k.hibino@gmail.com |

Safe Haskell | None |

This module defines monad transformer which lift
from `MonadQuery`

into Aggregated query.

- data Aggregatings ac at m a
- aggregatings :: Monad m => m a -> Aggregatings ac at m a
- type AggregatingSetT = Aggregatings Set AggregateElem
- type AggregatingSetListT = Aggregatings SetList AggregateSet
- type AggregatingPowerSetT = Aggregatings Power AggregateBitKey
- type PartitioningSetT c = Aggregatings c AggregateColumnRef
- extractAggregateTerms :: (Monad m, Functor m) => Aggregatings ac at m a -> m (a, [at])
- data AggregateKey a
- groupBy' :: MonadAggregate m => AggregateKey a -> m a
- type AggregatingSet = AggregatingSetT Identity
- type AggregatingPowerSet = AggregatingPowerSetT Identity
- type AggregatingSetList = AggregatingSetListT Identity
- type PartitioningSet c = PartitioningSetT c Identity
- key :: Projection Flat r -> AggregatingSet (Projection Aggregated (Maybe r))
- key' :: AggregateKey a -> AggregatingSet a
- set :: AggregatingSet a -> AggregatingSetList a
- bkey :: Projection Flat r -> AggregatingPowerSet (Projection Aggregated (Maybe r))
- rollup :: AggregatingPowerSet a -> AggregateKey a
- cube :: AggregatingPowerSet a -> AggregateKey a
- groupingSets :: AggregatingSetList a -> AggregateKey a

# Transformer into aggregated query

data Aggregatings ac at m a Source

Type to accumulate aggregating context.
Type `ac`

is aggregating-context type like aggregating key set building,
aggregating key sets set building and partition key set building.
Type `at`

is aggregating term type.

MonadQualify ConfigureQuery QueryAggregate | Instance to lift from qualified table forms into |

MonadRestrict c m => MonadRestrict c (AggregatingSetT m) | Aggregated |

MonadQuery m => MonadAggregate (AggregatingSetT m) | Aggregated query instance. |

MonadQuery m => MonadQuery (AggregatingSetT m) | Aggregated |

MonadTrans (Aggregatings ac at) | |

Monad m => MonadPartition (PartitioningSetT c m) | Partition clause instance |

Monad m => Monad (Aggregatings ac at m) | |

Functor m => Functor (Aggregatings ac at m) | |

Applicative m => Applicative (Aggregatings ac at m) |

aggregatings :: Monad m => m a -> Aggregatings ac at m aSource

Lift to `Aggregatings`

.

type AggregatingSetT = Aggregatings Set AggregateElemSource

Context type building one grouping set.

type AggregatingSetListT = Aggregatings SetList AggregateSetSource

Context type building grouping sets list.

type AggregatingPowerSetT = Aggregatings Power AggregateBitKeySource

Context type building power group set.

type PartitioningSetT c = Aggregatings c AggregateColumnRefSource

Context type building partition keys set.

# Result

extractAggregateTerms :: (Monad m, Functor m) => Aggregatings ac at m a -> m (a, [at])Source

Run `Aggregatings`

to get terms list.

# Grouping sets support

data AggregateKey a Source

Typeful aggregate element.

groupBy' :: MonadAggregate m => AggregateKey a -> m aSource

Add *GROUP BY* element into context and get aggregated projection.

type AggregatingSet = AggregatingSetT IdentitySource

Context monad type to build single grouping set.

type AggregatingPowerSet = AggregatingPowerSetT IdentitySource

Context monad type to build grouping power set.

type AggregatingSetList = AggregatingSetListT IdentitySource

Context monad type to build grouping set list.

type PartitioningSet c = PartitioningSetT c IdentitySource

Context monad type to build partition keys set.

key :: Projection Flat r -> AggregatingSet (Projection Aggregated (Maybe r))Source

Specify key of single grouping set from Projection.

key' :: AggregateKey a -> AggregatingSet aSource

Specify key of single grouping set.

set :: AggregatingSet a -> AggregatingSetList aSource

Finalize and specify single grouping set.

bkey :: Projection Flat r -> AggregatingPowerSet (Projection Aggregated (Maybe r))Source

Specify key of rollup and cube power set.

rollup :: AggregatingPowerSet a -> AggregateKey aSource

Finalize grouping power set as rollup power set.

cube :: AggregatingPowerSet a -> AggregateKey aSource

Finalize grouping power set as cube power set.

groupingSets :: AggregatingSetList a -> AggregateKey aSource

Finalize grouping set list.