Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class PGOrd a
- orderBy :: Order a -> Query a -> Query a
- asc :: PGOrd b => (a -> Column b) -> Order a
- desc :: PGOrd b => (a -> Column b) -> Order a
- ascNullsFirst :: PGOrd b => (a -> Column b) -> Order a
- descNullsLast :: PGOrd b => (a -> Column b) -> Order a
- limit :: Int -> Query a -> Query a
- offset :: Int -> Query a -> Query a
- data Order a
Documentation
Typeclass for Postgres types which support ordering operations.
Instances
PGOrd PGCitext Source # | |
Defined in Opaleye.SQLite.Order | |
PGOrd PGTimestamptz Source # | |
Defined in Opaleye.SQLite.Order | |
PGOrd PGTimestamp Source # | |
Defined in Opaleye.SQLite.Order | |
PGOrd PGTime Source # | |
Defined in Opaleye.SQLite.Order | |
PGOrd PGText Source # | |
Defined in Opaleye.SQLite.Order | |
PGOrd PGNumeric Source # | |
Defined in Opaleye.SQLite.Order | |
PGOrd PGInt2 Source # | |
Defined in Opaleye.SQLite.Order | |
PGOrd PGInt4 Source # | |
Defined in Opaleye.SQLite.Order | |
PGOrd PGInt8 Source # | |
Defined in Opaleye.SQLite.Order | |
PGOrd PGFloat8 Source # | |
Defined in Opaleye.SQLite.Order | |
PGOrd PGFloat4 Source # | |
Defined in Opaleye.SQLite.Order | |
PGOrd PGDate Source # | |
Defined in Opaleye.SQLite.Order | |
PGOrd PGBool Source # | |
Defined in Opaleye.SQLite.Order |
orderBy :: Order a -> Query a -> Query a Source #
Order the rows of a Query
according to the Order
.
import Data.Monoid (<>) -- Order by the first column ascending. When first columns are equal -- order by second column descending. example ::Query
(Column
PGInt4
,Column
PGText
) ->Query
(Column
PGInt4
,Column
PGText
) example =orderBy
(asc
fst <>desc
snd)
asc :: PGOrd b => (a -> Column b) -> Order a Source #
Specify an ascending ordering by the given expression. (Any NULLs appear last)
desc :: PGOrd b => (a -> Column b) -> Order a Source #
Specify an descending ordering by the given expression. (Any NULLs appear first)
ascNullsFirst :: PGOrd b => (a -> Column b) -> Order a Source #
Specify an ascending ordering by the given expression. (Any NULLs appear first)
descNullsLast :: PGOrd b => (a -> Column b) -> Order a Source #
Specify an descending ordering by the given expression. (Any NULLs appear last)
limit :: Int -> Query a -> Query a Source #
Limit the results of the given query to the given maximum number of items.
offset :: Int -> Query a -> Query a Source #
Offset the results of the given query by the given amount, skipping that many result rows.
An Order
represents an expression to order on and a sort
direction. Multiple Order
s can be composed with
mappend
. If two rows are equal according to the first
Order
, the second is used, and so on.