mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-15 06:43:04 +03:00
Moved definition.
This commit is contained in:
parent
ea7a30af28
commit
08d0d60ea7
@ -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
|
||||
|
@ -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 }
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user