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

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

Database.Relational.Query.Monad.Class

Contents

Description

This module defines query building interface classes.

Synopsis

Query interface classes

class (Functor q, Monad q, Functor m, Monad m) => MonadQualify q m where Source

Lift interface from base qualify monad.

Methods

liftQualify :: q a -> m a Source

Lift from qualify monad q into MonadQuery m. Qualify monad qualifies table form SubQuery.

Instances

MonadQualify ConfigureQuery Restrict

Instance to lift from qualified table forms into Restrict.

MonadQualify ConfigureQuery QueryAggregate

Instance to lift from qualified table forms into QueryAggregate.

MonadQualify ConfigureQuery (Assign r)

Instance to lift from qualified table forms into Restrict.

MonadQualify ConfigureQuery (Orderings Flat QueryCore)

Instance to lift from qualified table forms into QuerySimple.

class (Functor q, Monad q, MonadQuery m) => MonadQualifyUnique q m where Source

Lift interface from base qualify monad. Another constraint to support unique query.

Methods

liftQualifyUnique :: q a -> m a Source

Lift from qualify monad q into MonadQuery m. Qualify monad qualifies table form SubQuery.

Instances

MonadQualifyUnique ConfigureQuery QueryUnique

Instance to lift from qualified table forms into QueryUnique.

class (Functor m, Monad m) => MonadRestrict c m where Source

Restrict context interface

Methods

restrict Source

Arguments

:: Projection c (Maybe Bool)

Projection which represent restriction

-> m ()

Restricted query context

Add restriction to this context.

class (Functor m, Monad m) => MonadQuery m where Source

Query building interface.

Methods

setDuplication :: Duplication -> m () Source

Specify duplication.

restrictJoin Source

Arguments

:: Projection Flat (Maybe Bool)

Projection which represent restriction

-> m ()

Restricted query context | Unsafely join subquery with this query.

Add restriction to last join.

unsafeSubQuery Source

Arguments

:: NodeAttr

Attribute maybe or just

-> Qualified SubQuery

SubQuery to join

-> m (Projection Flat r)

Result joined context and SubQuery result projection.

Instances

MonadQuery QueryUnique 
MonadQuery m => MonadQuery (AggregatingSetT m)

Aggregated MonadQuery.

(Monad q, Functor q) => MonadQuery (QueryJoin q)

Joinable query instance.

MonadQuery q => MonadQuery (Restrictings c q)

Restricted MonadQuery instance.

MonadQuery m => MonadQuery (Orderings c m)

MonadQuery with ordering.

class MonadQuery m => MonadAggregate m where Source

Aggregated query building interface extends MonadQuery.

Methods

unsafeAddAggregateElement Source

Arguments

:: AggregateElem

Grouping element to add into group by clause

-> m ()

Result context

Add group by term into context and get aggregated projection.

Instances

MonadQuery m => MonadAggregate (AggregatingSetT m)

Aggregated query instance.

MonadAggregate m => MonadAggregate (Restrictings c m)

Resticted MonadAggregate instance.

MonadAggregate m => MonadAggregate (Orderings c m)

MonadAggregate with ordering.

class Monad m => MonadPartition m where Source

Window specification building interface.

Methods

unsafeAddPartitionKey Source

Arguments

:: AggregateColumnRef

Partitioning key to add into partition by clause

-> m ()

Result context

Instances

Monad m => MonadPartition (PartitioningSetT c m)

Partition clause instance

MonadPartition m => MonadPartition (Orderings c m)

MonadPartition with ordering.

all' :: MonadQuery m => m () Source

Specify ALL attribute to query context.

distinct :: MonadQuery m => m () Source

Specify DISTINCT attribute to query context.

onE :: MonadQuery m => Expr Flat (Maybe Bool) -> m () Source

Add restriction to last join.

on :: MonadQuery m => Projection Flat (Maybe Bool) -> m () Source

Add restriction to last join. Projection type version.

wheresE :: MonadRestrict Flat m => Expr Flat (Maybe Bool) -> m () Source

Add restriction to this query. Expr type version.

wheres :: MonadRestrict Flat m => Projection Flat (Maybe Bool) -> m () Source

Add restriction to this not aggregated query.

groupBy Source

Arguments

:: MonadAggregate m 
=> Projection Flat r

Projection to add into group by

-> m (Projection Aggregated r)

Result context and aggregated projection

Add GROUP BY term into context and get aggregated projection.

havingE :: MonadRestrict Aggregated m => Expr Aggregated (Maybe Bool) -> m () Source

Add restriction to this aggregated query. Expr type version.

having :: MonadRestrict Aggregated m => Projection Aggregated (Maybe Bool) -> m () Source

Add restriction to this aggregated query. Aggregated Projection type version.