mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-04 15:03:58 +03:00
relational-query: simplify module dependency. projecting interface.
This commit is contained in:
parent
d044616d82
commit
c005b9a98a
@ -21,7 +21,8 @@ module Database.Relational.Query.Internal.Sub
|
||||
, ProductTreeBuilder, ProductBuilder
|
||||
|
||||
, UntypedProjection, untypedProjectionWidth, ProjectionUnit (..)
|
||||
, Projection, untypeProjection, typedProjection, projectionWidth, projectFromColumns
|
||||
, Projection, untypeProjection, typedProjection, projectionWidth
|
||||
, projectFromColumns, projectFromScalarSubQuery
|
||||
|
||||
-- * Query restriction
|
||||
, QueryRestriction
|
||||
@ -138,6 +139,10 @@ projectFromColumns :: [ColumnSQL] -- ^ SQL string list specifies columns
|
||||
-> Projection c r -- ^ Result 'Projection'
|
||||
projectFromColumns = typedProjection . map RawColumn
|
||||
|
||||
-- | Unsafely generate 'Projection' from scalar sub-query.
|
||||
projectFromScalarSubQuery :: SubQuery -> Projection c t
|
||||
projectFromScalarSubQuery = typedProjection . (:[]) . Scalar
|
||||
|
||||
|
||||
-- | Type for restriction of query.
|
||||
type QueryRestriction c = [Projection c (Maybe Bool)]
|
||||
|
@ -61,7 +61,7 @@ import Database.Relational.Query.Pi (Pi)
|
||||
import qualified Database.Relational.Query.Pi.Unsafe as UnsafePi
|
||||
import Database.Relational.Query.Sub
|
||||
(projectionColumns,
|
||||
untypedProjectionFromJoinedSubQuery, untypedProjectionFromScalarSubQuery,
|
||||
untypedProjectionFromJoinedSubQuery,
|
||||
unsafeProjectionStringSql)
|
||||
import qualified Database.Relational.Query.Sub as SubQuery
|
||||
|
||||
@ -90,7 +90,7 @@ unsafeFromQualifiedSubQuery = typedProjection . untypedProjectionFromJoinedSubQ
|
||||
|
||||
-- | Unsafely generate 'Projection' from scalar sub-query.
|
||||
unsafeFromScalarSubQuery :: SubQuery -> Projection c t
|
||||
unsafeFromScalarSubQuery = typedProjection . untypedProjectionFromScalarSubQuery
|
||||
unsafeFromScalarSubQuery = Internal.projectFromScalarSubQuery
|
||||
|
||||
-- | Unsafely generate unqualified 'Projection' from 'Table'.
|
||||
unsafeFromTable :: Table r
|
||||
|
@ -30,12 +30,12 @@ module Database.Relational.Query.Sub (
|
||||
-- * Projection
|
||||
Projection, ProjectionUnit, UntypedProjection,
|
||||
|
||||
untypedProjectionFromJoinedSubQuery, untypedProjectionFromScalarSubQuery,
|
||||
untypedProjectionFromJoinedSubQuery,
|
||||
|
||||
projectionColumns, unsafeProjectionStringSql,
|
||||
|
||||
-- deprecated interfaces
|
||||
untypedProjectionFromColumns,
|
||||
untypedProjectionFromColumns, untypedProjectionFromScalarSubQuery,
|
||||
unsafeProjectFromColumns,
|
||||
widthOfUntypedProjection, columnsOfUntypedProjection,
|
||||
|
||||
@ -256,6 +256,7 @@ column qs = d (Internal.unQualify qs) where
|
||||
untypedProjectionFromColumns :: [ColumnSQL] -> UntypedProjection
|
||||
untypedProjectionFromColumns = map RawColumn
|
||||
|
||||
{-# DEPRECATED untypedProjectionFromScalarSubQuery "prepare to drop public interface. use ( (:[]) . Scalar )." #-}
|
||||
-- | Make untyped projection from scalar sub-query.
|
||||
untypedProjectionFromScalarSubQuery :: SubQuery -> UntypedProjection
|
||||
untypedProjectionFromScalarSubQuery = (:[]) . Scalar
|
||||
|
Loading…
Reference in New Issue
Block a user