relational-query-0.0.1.4: Typeful, Modular, Relational, algebraic query engine

Copyright2013 Kei Hibino
LicenseBSD3
Maintainerex8k.hibino@gmail.com
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Database.Relational.Query.Monad.Trans.Aggregating

Contents

Description

This module defines monad transformer which lift from MonadQuery into Aggregated query.

Synopsis

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.

Instances

MonadQualify ConfigureQuery QueryAggregate

Instance to lift from qualified table forms into QueryAggregate.

MonadRestrict c m => MonadRestrict c (AggregatingSetT m)

Aggregated MonadRestrict.

MonadQuery m => MonadAggregate (AggregatingSetT m)

Aggregated query instance.

MonadQuery m => MonadQuery (AggregatingSetT m)

Aggregated MonadQuery.

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

data AggregateKey a Source

Typeful aggregate element.

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

Add GROUP BY element into context and get aggregated projection.

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.