opaleye-0.6.7000.0: An SQL-generating DSL targeting PostgreSQL

Safe HaskellNone
LanguageHaskell2010

Opaleye.Internal.Order

Synopsis

Documentation

newtype Order a Source #

An Order a represents a sort order and direction for the elements of the type a. Multiple Orders can be composed with mappend or (<>) from Data.Monoid. If two rows are equal according to the first Order in the mappend, the second is used, and so on.

Constructors

Order (a -> [(OrderOp, PrimExpr)]) 

Instances

Divisible Order Source # 

Methods

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

conquer :: Order a #

Decidable Order Source # 

Methods

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

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

Contravariant Order Source # 

Methods

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

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

Semigroup (Order a) Source # 

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 # 

Methods

mempty :: Order a #

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

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

order :: OrderOp -> (a -> Column b) -> Order a Source #

orderByU :: Order a -> (a, PrimQuery, Tag) -> (a, PrimQuery, Tag) Source #

limit' :: Int -> (a, PrimQuery, Tag) -> (a, PrimQuery, Tag) Source #

offset' :: Int -> (a, PrimQuery, Tag) -> (a, PrimQuery, Tag) Source #

exact :: [Column b] -> (a -> Column b) -> Order a Source #

Order the results of a given query exactly, as determined by the given list of input columns. Note that this list does not have to contain an entry for every result in your query: you may exactly order only a subset of results, if you wish. Rows that are not ordered according to the input list are returned after the ordered results, in the usual order the database would return them (e.g. sorted by primary key). Exactly-ordered results always come first in a result set. Entries in the input list that are not present in result of a query are ignored.