opaleye-sqlite-0.0.1.1: An SQL-generating DSL targeting SQLite
Safe HaskellNone
LanguageHaskell2010

Opaleye.SQLite.Order

Synopsis

Documentation

class PGOrd a Source #

Typeclass for Postgres types which support ordering operations.

Instances

Instances details
PGOrd PGCitext Source # 
Instance details

Defined in Opaleye.SQLite.Order

PGOrd PGTimestamptz Source # 
Instance details

Defined in Opaleye.SQLite.Order

PGOrd PGTimestamp Source # 
Instance details

Defined in Opaleye.SQLite.Order

PGOrd PGTime Source # 
Instance details

Defined in Opaleye.SQLite.Order

PGOrd PGText Source # 
Instance details

Defined in Opaleye.SQLite.Order

PGOrd PGNumeric Source # 
Instance details

Defined in Opaleye.SQLite.Order

PGOrd PGInt2 Source # 
Instance details

Defined in Opaleye.SQLite.Order

PGOrd PGInt4 Source # 
Instance details

Defined in Opaleye.SQLite.Order

PGOrd PGInt8 Source # 
Instance details

Defined in Opaleye.SQLite.Order

PGOrd PGFloat8 Source # 
Instance details

Defined in Opaleye.SQLite.Order

PGOrd PGFloat4 Source # 
Instance details

Defined in Opaleye.SQLite.Order

PGOrd PGDate Source # 
Instance details

Defined in Opaleye.SQLite.Order

PGOrd PGBool Source # 
Instance details

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.

data Order a Source #

An Order represents an expression to order on and a sort direction. Multiple Orders can be composed with mappend. If two rows are equal according to the first Order, the second is used, and so on.

Instances

Instances details
Contravariant Order Source # 
Instance details

Defined in Opaleye.SQLite.Internal.Order

Methods

contramap :: (a -> b) -> Order b -> Order a #

(>$) :: b -> Order b -> Order a #

Divisible Order Source # 
Instance details

Defined in Opaleye.SQLite.Internal.Order

Methods

divide :: (a -> (b, c)) -> Order b -> Order c -> Order a #

conquer :: Order a #

Decidable Order Source # 
Instance details

Defined in Opaleye.SQLite.Internal.Order

Methods

lose :: (a -> Void) -> Order a #

choose :: (a -> Either b c) -> Order b -> Order c -> Order a #

Semigroup (Order a) Source # 
Instance details

Defined in Opaleye.SQLite.Internal.Order

Methods

(<>) :: Order a -> Order a -> Order a #

sconcat :: NonEmpty (Order a) -> Order a #

stimes :: Integral b => b -> Order a -> Order a #

Monoid (Order a) Source # 
Instance details

Defined in Opaleye.SQLite.Internal.Order

Methods

mempty :: Order a #

mappend :: Order a -> Order a -> Order a #

mconcat :: [Order a] -> Order a #