Copyright | (c) Eitan Chatav 2019 |
---|---|
Maintainer | eitan@morphism.tech |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
sort expressions
Synopsis
- data SortExpression grp lat with db params from where
- Asc :: Expression grp lat with db params from ('NotNull ty) -> SortExpression grp lat with db params from
- Desc :: Expression grp lat with db params from ('NotNull ty) -> SortExpression grp lat with db params from
- AscNullsFirst :: Expression grp lat with db params from ('Null ty) -> SortExpression grp lat with db params from
- AscNullsLast :: Expression grp lat with db params from ('Null ty) -> SortExpression grp lat with db params from
- DescNullsFirst :: Expression grp lat with db params from ('Null ty) -> SortExpression grp lat with db params from
- DescNullsLast :: Expression grp lat with db params from ('Null ty) -> SortExpression grp lat with db params from
- class OrderBy expr grp | expr -> grp where
- orderBy :: [SortExpression grp lat with db params from] -> expr lat with db params from -> expr lat with db params from
Sort
data SortExpression grp lat with db 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 | |
| |
Desc | |
| |
AscNullsFirst | |
| |
AscNullsLast | |
| |
DescNullsFirst | |
| |
DescNullsLast | |
|
Instances
RenderSQL [SortExpression grp lat with db params from] Source # | |
Defined in Squeal.PostgreSQL.Expression.Sort renderSQL :: [SortExpression grp lat with db params from] -> ByteString Source # | |
Show (SortExpression grp lat with db params from) Source # | |
Defined in Squeal.PostgreSQL.Expression.Sort showsPrec :: Int -> SortExpression grp lat with db params from -> ShowS # show :: SortExpression grp lat with db params from -> String # showList :: [SortExpression grp lat with db params from] -> ShowS # | |
RenderSQL (SortExpression grp lat with db params from) Source # | |
Defined in Squeal.PostgreSQL.Expression.Sort renderSQL :: SortExpression grp lat with db params from -> ByteString Source # |
class OrderBy expr grp | expr -> grp 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
.
:: [SortExpression grp lat with db params from] | sorts |
-> expr lat with db params from | |
-> expr lat with db params from |
Instances
OrderBy (TableExpression grp) grp Source # | |
Defined in Squeal.PostgreSQL.Query.Table orderBy :: forall (lat :: FromType) (with :: FromType) (db :: SchemasType) (params :: [NullType]) (from :: FromType). [SortExpression grp lat with db params from] -> TableExpression grp lat with db params from -> TableExpression grp lat with db params from Source # | |
OrderBy (AggregateArg xs) 'Ungrouped Source # | |
Defined in Squeal.PostgreSQL.Expression.Aggregate orderBy :: forall (lat :: FromType) (with :: FromType) (db :: SchemasType) (params :: [NullType]) (from :: FromType). [SortExpression 'Ungrouped lat with db params from] -> AggregateArg xs lat with db params from -> AggregateArg xs lat with db params from Source # | |
OrderBy (WindowDefinition grp) grp Source # | |
Defined in Squeal.PostgreSQL.Expression.Window orderBy :: forall (lat :: FromType) (with :: FromType) (db :: SchemasType) (params :: [NullType]) (from :: FromType). [SortExpression grp lat with db params from] -> WindowDefinition grp lat with db params from -> WindowDefinition grp lat with db params from Source # |