| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Rel8.Internal.Window
Documentation
Window is an applicative functor that represents expressions that
contain
window functions.
window can be used to
evaluate these expressions over a particular query.
Constructors
| Window (Windows a b) |
Instances
| ProductProfunctor Window Source # | |
| Profunctor Window Source # | |
Defined in Rel8.Internal.Window Methods dimap :: (a -> b) -> (c -> d) -> Window b c -> Window a d lmap :: (a -> b) -> Window b c -> Window a c rmap :: (b -> c) -> Window a b -> Window a c (#.) :: forall a b c q. Coercible c b => q b c -> Window a b -> Window a c (.#) :: forall a b c q. Coercible b a => Window b c -> q a b -> Window a c | |
| Applicative (Window a) Source # | |
| Functor (Window a) Source # | |
| Apply (Window a) Source # | |
In PostgreSQL, window functions must specify the "window" or
"partition" over which they operate. The syntax for this looks like:
SUM(salary) OVER (PARTITION BY department). The Rel8 type Partition
represents everything that comes after OVER.
Partition is a Monoid, so Windows created with partitionBy and
orderWindowBy can be combined using <>.
over :: Window a b -> Partition a -> Window a b infixl 1 Source #
over adds a Partition to a Window expression.
cumulative(sum. salary)overpartitionBydepartment <>orderPartitionBy(salary >$<desc)
partitionBy :: EqTable b => (a -> b) -> Partition a Source #
Restricts a window function to operate only the group of rows that share the same value(s) for the given expression(s).
orderPartitionBy :: Order a -> Partition a Source #
Controls the order in which rows are processed by window functions. This does not need to match the ordering of the overall query.