Moved definition.

This commit is contained in:
Kei Hibino 2013-09-07 14:29:08 +09:00
parent ea7a30af28
commit 08d0d60ea7
5 changed files with 24 additions and 23 deletions

View File

@ -20,7 +20,6 @@ module Database.Relational.Query (
module Database.Relational.Query.Projectable,
module Database.Relational.Query.ProjectableExtended,
module Database.Relational.Query.Monad.Class,
module Database.Relational.Query.Monad.Trans.Config,
module Database.Relational.Query.Monad.Trans.Ordering,
module Database.Relational.Query.Monad.Trans.Assigning,
module Database.Relational.Query.Monad.Type,
@ -45,13 +44,12 @@ import Database.Relational.Query.Constraint
Primary, Unique, NotNull)
import Database.Relational.Query.Context
import Database.Relational.Query.Expr hiding (fromJust, just)
import Database.Relational.Query.Sub (SubQuery, unitSQL, queryWidth)
import Database.Relational.Query.Sub (SubQuery, unitSQL, queryWidth, Config, defaultConfig)
import Database.Relational.Query.Projection (Projection, list)
import Database.Relational.Query.Projectable
import Database.Relational.Query.ProjectableExtended
import Database.Relational.Query.Monad.Class
(on, wheres, groupBy, having, onE, wheresE, havingE)
import Database.Relational.Query.Monad.Trans.Config (Config, defaultConfig)
import Database.Relational.Query.Monad.Trans.Ordering (asc, desc)
import Database.Relational.Query.Monad.Trans.Assigning (assignTo, (!#), (<-#))
import Database.Relational.Query.Monad.Type

View File

@ -12,8 +12,6 @@
-- This module defines monad transformer which requires query generate configuration.
module Database.Relational.Query.Monad.Trans.Config (
-- * Transformer into query with configuration
Config, defaultConfig,
QueryConfig, config,
runQueryConfig, askConfig
) where
@ -22,16 +20,9 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
import Control.Monad.Trans.Reader (ReaderT, runReaderT, ask)
import Control.Applicative (Applicative)
import Database.Relational.Query.Sub (UnitProductSupport (UPSupported))
import Database.Relational.Query.Sub (Config)
-- | Configuration type.
type Config = UnitProductSupport
-- | Default configuration.
defaultConfig :: Config
defaultConfig = UPSupported
-- | 'ReaderT' type to require query generate configuration.
newtype QueryConfig m a =
QueryConfig { queryConfig :: ReaderT Config m a }

View File

@ -13,11 +13,11 @@ module Database.Relational.Query.Monad.Type (
ConfigureQuery, configureQuery, qualifyQuery, QueryCore,
) where
import Database.Relational.Query.Sub (Qualified)
import Database.Relational.Query.Sub (Qualified, Config)
import Database.Relational.Query.Context (Flat)
import qualified Database.Relational.Query.Monad.Qualify as Qualify
import Database.Relational.Query.Monad.Qualify (Qualify, evalQualifyPrime)
import Database.Relational.Query.Monad.Trans.Config (Config, QueryConfig, runQueryConfig, config)
import Database.Relational.Query.Monad.Trans.Config (QueryConfig, runQueryConfig, config)
import Database.Relational.Query.Monad.Trans.Join (QueryJoin)
import Database.Relational.Query.Monad.Trans.Restricting (Restrictings)

View File

@ -39,7 +39,6 @@ module Database.Relational.Query.Relation (
) where
import Database.Relational.Query.Context (Flat, Aggregated)
import Database.Relational.Query.Monad.Trans.Config (Config, defaultConfig)
import Database.Relational.Query.Monad.Type (ConfigureQuery, configureQuery, qualifyQuery)
import Database.Relational.Query.Monad.Class
(MonadQualify (liftQualify), MonadQuery (unsafeSubQuery), on)
@ -58,7 +57,7 @@ import qualified Database.Relational.Query.Projection as Projection
import Database.Relational.Query.Projectable
(PlaceHolders, addPlaceHolders, unsafePlaceHolders, projectZip)
import Database.Relational.Query.Sub (SubQuery)
import Database.Relational.Query.Sub (SubQuery, Config, defaultConfig)
import qualified Database.Relational.Query.Sub as SubQuery

View File

@ -31,13 +31,16 @@ module Database.Relational.Query.Sub (
untypedProjectionFromColumns, untypedProjectionFromSubQuery,
widthOfProjectionUnit, columnOfProjectionUnit,
-- * Configuration type for query
Config, defaultConfig,
UnitProductSupport (..),
-- * Product of sub-queries
QueryProduct, QueryProductNode,
queryProductSQL,
UnitProductSupport (..),
JoinProduct,
-- * Query restriction
@ -54,7 +57,8 @@ import Data.Maybe (fromMaybe)
import Data.Array (Array, listArray)
import qualified Data.Array as Array
import Database.Relational.Query.Context (Aggregated)
-- import Database.Relational.Query.Context (Aggregated)
import qualified Database.Relational.Query.Context as Context
import Database.Relational.Query.Expr (Expr, valueExpr)
import Database.Relational.Query.Expr.Unsafe (showExpr)
import Database.Relational.Query.Internal.Product
@ -273,6 +277,17 @@ columnOfProjectionUnit = d where
where w = unQualify qw
-- | Configuration type.
type Config = UnitProductSupport
-- | Default configuration.
defaultConfig :: Config
defaultConfig = UPSupported
-- | Unit product is supported or not.
data UnitProductSupport = UPSupported | UPNotSupported
-- | Product tree specialized by 'SubQuery'.
type QueryProduct = ProductTree (Qualified SubQuery)
-- | Product node specialized by 'SubQuery'.
@ -305,8 +320,6 @@ queryProductSQL = ($ "") . showsQueryProduct
-- | Type for join product of query.
type JoinProduct = Maybe QueryProduct
data UnitProductSupport = UPSupported | UPNotSupported
-- | Shows join product of query.
_showsJoinProduct :: UnitProductSupport -> Maybe QueryProduct -> ShowS
_showsJoinProduct ups = maybe (up ups) from where
@ -325,7 +338,7 @@ type AggregateTerm = ColumnSQL
type AggregateTerms = [AggregateTerm]
-- | Type for restriction of aggregated query.
type AggregatedQueryRestriction = Maybe (Expr Aggregated Bool)
type AggregatedQueryRestriction = Maybe (Expr Context.Aggregated Bool)
-- | Order direction. Ascendant or Descendant.