mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-02 08:12:49 +03:00
relational-query: inlining composeOver.
This commit is contained in:
parent
f01925f732
commit
e5a28f9772
@ -223,6 +223,7 @@ composeValues :: [Assignment] -> StringSQL
|
||||
composeValues = BaseSQL.composeValues
|
||||
|
||||
|
||||
{-# DEPRECATED composeOver "prepare to drop public interface." #-}
|
||||
-- | Compose /OVER (PARTITION BY ... )/ clause.
|
||||
composeOver :: [AggregateColumnRef] -> OrderingTerms -> StringSQL
|
||||
composeOver pts ots =
|
||||
|
@ -29,13 +29,16 @@ module Database.Relational.Query.Monad.Aggregate (
|
||||
import Data.Functor.Identity (Identity (runIdentity))
|
||||
import Data.Monoid ((<>))
|
||||
|
||||
import Language.SQL.Keyword (Keyword(..))
|
||||
import qualified Language.SQL.Keyword as SQL
|
||||
|
||||
import Database.Relational.Query.Internal.SQL (showsColumnSQL)
|
||||
import Database.Relational.Query.Internal.BaseSQL (Duplication, OrderingTerm, composeOrderBy)
|
||||
import Database.Relational.Query.Internal.GroupingSQL (AggregateColumnRef, AggregateElem, composePartitionBy)
|
||||
|
||||
import Database.Relational.Query.Context (Flat, Aggregated, OverWindow)
|
||||
import Database.Relational.Query.Projection (Projection)
|
||||
import qualified Database.Relational.Query.Projection as Projection
|
||||
import Database.Relational.Query.Component
|
||||
(AggregateColumnRef, Duplication, OrderingTerm, AggregateElem, composeOver)
|
||||
import Database.Relational.Query.Sub (SubQuery, QueryRestriction, JoinProduct, aggregatedSubQuery)
|
||||
import qualified Database.Relational.Query.Sub as SubQuery
|
||||
import Database.Relational.Query.Projectable (PlaceHolders, SqlProjectable)
|
||||
@ -94,7 +97,7 @@ over :: SqlProjectable (Projection c)
|
||||
-> Projection c a
|
||||
wp `over` win =
|
||||
Projection.unsafeFromSqlTerms
|
||||
[ showsColumnSQL c <> composeOver pt ot
|
||||
[ showsColumnSQL c <> OVER <> SQL.paren (composePartitionBy pt <> composeOrderBy ot)
|
||||
| c <- Projection.columns wp
|
||||
] where (((), ot), pt) = extractWindow win
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user