Copyright | 2013 Kei Hibino |
---|---|
License | BSD3 |
Maintainer | ex8k.hibino@gmail.com |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
This module defines query building interface classes.
- class (Functor q, Monad q, Functor m, Monad m) => MonadQualify q m where
- liftQualify :: q a -> m a
- class (Functor q, Monad q, MonadQuery m) => MonadQualifyUnique q m where
- liftQualifyUnique :: q a -> m a
- class (Functor m, Monad m) => MonadRestrict c m where
- restrict :: Projection c (Maybe Bool) -> m ()
- class (Functor m, Monad m) => MonadQuery m where
- setDuplication :: Duplication -> m ()
- restrictJoin :: Projection Flat (Maybe Bool) -> m ()
- unsafeSubQuery :: NodeAttr -> Qualified SubQuery -> m (Projection Flat r)
- class MonadQuery m => MonadAggregate m where
- unsafeAddAggregateElement :: AggregateElem -> m ()
- class Monad m => MonadPartition m where
- unsafeAddPartitionKey :: AggregateColumnRef -> m ()
- all' :: MonadQuery m => m ()
- distinct :: MonadQuery m => m ()
- onE :: MonadQuery m => Expr Flat (Maybe Bool) -> m ()
- on :: MonadQuery m => Projection Flat (Maybe Bool) -> m ()
- wheresE :: MonadRestrict Flat m => Expr Flat (Maybe Bool) -> m ()
- wheres :: MonadRestrict Flat m => Projection Flat (Maybe Bool) -> m ()
- groupBy :: MonadAggregate m => Projection Flat r -> m (Projection Aggregated r)
- havingE :: MonadRestrict Aggregated m => Expr Aggregated (Maybe Bool) -> m ()
- having :: MonadRestrict Aggregated m => Projection Aggregated (Maybe Bool) -> m ()
Query interface classes
class (Functor q, Monad q, Functor m, Monad m) => MonadQualify q m where Source
Lift interface from base qualify monad.
liftQualify :: q a -> m a Source
Lift from qualify monad q
into MonadQuery
m.
Qualify monad qualifies table form SubQuery
.
MonadQualify ConfigureQuery Restrict | Instance to lift from qualified table forms into |
MonadQualify ConfigureQuery QueryAggregate | Instance to lift from qualified table forms into |
MonadQualify ConfigureQuery (Assign r) | Instance to lift from qualified table forms into |
MonadQualify ConfigureQuery (Orderings Flat QueryCore) | Instance to lift from qualified table forms into |
class (Functor q, Monad q, MonadQuery m) => MonadQualifyUnique q m where Source
Lift interface from base qualify monad. Another constraint to support unique query.
liftQualifyUnique :: q a -> m a Source
Lift from qualify monad q
into MonadQuery
m.
Qualify monad qualifies table form SubQuery
.
MonadQualifyUnique ConfigureQuery QueryUnique | Instance to lift from qualified table forms into |
class (Functor m, Monad m) => MonadRestrict c m where Source
Restrict context interface
:: Projection c (Maybe Bool) |
|
-> m () | Restricted query context |
Add restriction to this context.
MonadRestrict c m => MonadRestrict c (AggregatingSetT m) | Aggregated |
(Monad q, Functor q) => MonadRestrict c (Restrictings c q) |
|
MonadRestrict rc m => MonadRestrict rc (Orderings c m) |
|
MonadRestrict c m => MonadRestrict c (Assignings r m) |
|
MonadRestrict Flat q => MonadRestrict Flat (Restrictings Aggregated q) | Restricted |
class (Functor m, Monad m) => MonadQuery m where Source
Query building interface.
setDuplication :: Duplication -> m () Source
Specify duplication.
:: Projection Flat (Maybe Bool) |
|
-> m () | Restricted query context | Unsafely join subquery with this query. |
Add restriction to last join.
MonadQuery QueryUnique | |
MonadQuery m => MonadQuery (AggregatingSetT m) | Aggregated |
(Monad q, Functor q) => MonadQuery (QueryJoin q) | Joinable query instance. |
MonadQuery q => MonadQuery (Restrictings c q) | Restricted |
MonadQuery m => MonadQuery (Orderings c m) |
|
class MonadQuery m => MonadAggregate m where Source
Aggregated query building interface extends MonadQuery
.
unsafeAddAggregateElement Source
:: AggregateElem | Grouping element to add into group by clause |
-> m () | Result context |
Add group by term into context and get aggregated projection.
MonadQuery m => MonadAggregate (AggregatingSetT m) | Aggregated query instance. |
MonadAggregate m => MonadAggregate (Restrictings c m) | Resticted |
MonadAggregate m => MonadAggregate (Orderings c m) |
|
class Monad m => MonadPartition m where Source
Window specification building interface.
:: AggregateColumnRef | Partitioning key to add into partition by clause |
-> m () | Result context |
Monad m => MonadPartition (PartitioningSetT c m) | Partition clause instance |
MonadPartition m => MonadPartition (Orderings c m) |
|
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.
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.
:: 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.