Copyright | 2013 Kei Hibino |
---|---|

License | BSD3 |

Maintainer | ex8k.hibino@gmail.com |

Stability | experimental |

Portability | unknown |

Safe Haskell | None |

Language | Haskell2010 |

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])
- 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 q m => MonadQualify q (AggregatingSetT m) Source | Aggregated |

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

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

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

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

MonadTrans (Aggregatings ac at) Source | |

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

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

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

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

Lift to `Aggregatings`

.

type AggregatingSetT = Aggregatings Set AggregateElem Source

Context type building one grouping set.

type AggregatingSetListT = Aggregatings SetList AggregateSet Source

Context type building grouping sets list.

type AggregatingPowerSetT = Aggregatings Power AggregateBitKey Source

Context type building power group set.

type PartitioningSetT c = Aggregatings c AggregateColumnRef Source

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

type AggregatingSet = AggregatingSetT Identity Source

Context monad type to build single grouping set.

type AggregatingPowerSet = AggregatingPowerSetT Identity Source

Context monad type to build grouping power set.

type AggregatingSetList = AggregatingSetListT Identity Source

Context monad type to build grouping set list.

type PartitioningSet c = PartitioningSetT c Identity Source

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 a Source

Specify key of single grouping set.

set :: AggregatingSet a -> AggregatingSetList a Source

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 a Source

Finalize grouping power set as rollup power set.

cube :: AggregatingPowerSet a -> AggregateKey a Source

Finalize grouping power set as cube power set.

groupingSets :: AggregatingSetList a -> AggregateKey a Source

Finalize grouping set list.