relational-query-0.8.3.2: 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.

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, MonadQualify ConfigureQuery 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

Add restriction to last join.

query' :: Relation p r -> m (PlaceHolders p, Projection Flat r) Source

Join sub-query with place-holder parameter p. query result is not Maybe.

queryMaybe' :: Relation p r -> m (PlaceHolders p, Projection Flat (Maybe r)) Source

Join sub-query with place-holder parameter p. Query result is Maybe.

class MonadQuery m => MonadAggregate m where Source

Aggregated query building interface extends MonadQuery.

Methods

groupBy Source

Arguments

:: 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. Non-traditional group-by version.

Add GROUP BY term into context and get aggregated projection.

groupBy' Source

Arguments

:: AggregateKey (Projection Aggregated r)

Key to aggretate for non-traditional group-by interface

-> m (Projection Aggregated r)

Result context and aggregated projection

Instances

class Monad m => MonadPartition c m where Source

Window specification building interface.

Methods

partitionBy :: Projection c r -> m () Source

Add PARTITION BY term into context.

Instances

Monad m => MonadPartition c (PartitioningSetT c m) Source

Partition clause instance

MonadPartition c m => MonadPartition c (Orderings c m) Source

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.

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

Add restriction to last join. Projection type version.

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

Add restriction to this not aggregated query.

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

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