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

Portabilityunknown
Stabilityexperimental
Maintainerex8k.hibino@gmail.com
Safe HaskellNone

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