Copyright | (c) Eitan Chatav 2019 |
---|---|
Maintainer | eitan@morphism.tech |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Sort expressions
Synopsis
- data SortExpression outer commons grp schemas params from where
- Asc :: Expression outer commons grp schemas params from (NotNull ty) -> SortExpression outer commons grp schemas params from
- Desc :: Expression outer commons grp schemas params from (NotNull ty) -> SortExpression outer commons grp schemas params from
- AscNullsFirst :: Expression outer commons grp schemas params from (Null ty) -> SortExpression outer commons grp schemas params from
- AscNullsLast :: Expression outer commons grp schemas params from (Null ty) -> SortExpression outer commons grp schemas params from
- DescNullsFirst :: Expression outer commons grp schemas params from (Null ty) -> SortExpression outer commons grp schemas params from
- DescNullsLast :: Expression outer commons grp schemas params from (Null ty) -> SortExpression outer commons grp schemas params from
- class OrderBy expr where
- orderBy :: [SortExpression outer commons grp schemas params from] -> expr outer commons grp schemas params from -> expr outer commons grp schemas params from
Documentation
data SortExpression outer commons grp schemas params from where Source #
SortExpression
s are used by orderBy
to optionally sort the results
of a Query
. Asc
or Desc
set the sort direction of a NotNull
result
column to ascending or descending. Ascending order puts smaller values
first, where "smaller" is defined in terms of the
.<
operator. Similarly,
descending order is determined with the
.>
operator. AscNullsFirst
,
AscNullsLast
, DescNullsFirst
and DescNullsLast
options are used to
determine whether nulls appear before or after non-null values in the sort
ordering of a Null
result column.
Asc :: Expression outer commons grp schemas params from (NotNull ty) -> SortExpression outer commons grp schemas params from | |
Desc :: Expression outer commons grp schemas params from (NotNull ty) -> SortExpression outer commons grp schemas params from | |
AscNullsFirst :: Expression outer commons grp schemas params from (Null ty) -> SortExpression outer commons grp schemas params from | |
AscNullsLast :: Expression outer commons grp schemas params from (Null ty) -> SortExpression outer commons grp schemas params from | |
DescNullsFirst :: Expression outer commons grp schemas params from (Null ty) -> SortExpression outer commons grp schemas params from | |
DescNullsLast :: Expression outer commons grp schemas params from (Null ty) -> SortExpression outer commons grp schemas params from |
Instances
Show (SortExpression outer commons grp schemas params from) Source # | |
Defined in Squeal.PostgreSQL.Expression.Sort showsPrec :: Int -> SortExpression outer commons grp schemas params from -> ShowS # show :: SortExpression outer commons grp schemas params from -> String # showList :: [SortExpression outer commons grp schemas params from] -> ShowS # | |
RenderSQL (SortExpression outer commons grp schemas params from) Source # | |
Defined in Squeal.PostgreSQL.Expression.Sort renderSQL :: SortExpression outer commons grp schemas params from -> ByteString Source # |
class OrderBy expr where Source #
The orderBy
clause causes the result rows of a TableExpression
to be sorted according to the specified SortExpression
(s).
If two rows are equal according to the leftmost expression,
they are compared according to the next expression and so on.
If they are equal according to all specified expressions,
they are returned in an implementation-dependent order.
You can also control the order in which rows are processed by window functions
using orderBy
within Over
.
orderBy :: [SortExpression outer commons grp schemas params from] -> expr outer commons grp schemas params from -> expr outer commons grp schemas params from Source #
Instances
OrderBy WindowDefinition Source # | |
Defined in Squeal.PostgreSQL.Expression.Window orderBy :: [SortExpression outer commons grp schemas params from] -> WindowDefinition outer commons grp schemas params from -> WindowDefinition outer commons grp schemas params from Source # | |
OrderBy TableExpression Source # | |
Defined in Squeal.PostgreSQL.Query orderBy :: [SortExpression outer commons grp schemas params from] -> TableExpression outer commons grp schemas params from -> TableExpression outer commons grp schemas params from Source # |