Safe Haskell | None |
---|---|
Language | Haskell2010 |
Converting a sorting specification to a value understandable by Beam.
Synopsis
- type SortingSpecApp backend (allParams :: [TyNamedParam Type]) = HList (SortingApp backend) allParams
- fieldSort :: forall (name :: Symbol) a backend. (SortingBackend backend, SortedValueConstraint backend a) => SortedValue backend a -> SortingApp backend ('TyNamedParam name a)
- sortBy_ :: (backend ~ BeamSortingBackend syntax0 s0, allParams ~ AllSortingParams provided base, ApplyToSortItem backend allParams, Projectible be a, SqlOrderable be (BackendOrdering backend), ThreadRewritable (QNested s) a) => SortingSpec provided base -> (a -> SortingSpecApp backend allParams) -> Q be db (QNested s) a -> Q be db s (WithRewrittenThread (QNested s) s a)
Documentation
type SortingSpecApp backend (allParams :: [TyNamedParam Type]) = HList (SortingApp backend) allParams #
List of SortingApp
functions. Describes how to apply SortingSpec params
(each of possible SortingItem
) to an SQL query.
Instance of this type can be created using fieldSort
function. For example:
sortingSpecApp :: SortingSpecApp ["course" ?: Course, "desc" ?: Text]
sortingSpecApp =
fieldSort "course" courseField .*.
fieldSort
"desc" descField .*.
HNil
Annotating fieldSort
call with parameter name is not mandatory but recommended
to prevent possible mistakes in fieldSort
s ordering.
fieldSort :: forall (name :: Symbol) a backend. (SortingBackend backend, SortedValueConstraint backend a) => SortedValue backend a -> SortingApp backend ('TyNamedParam name a) #
sortBy_ :: (backend ~ BeamSortingBackend syntax0 s0, allParams ~ AllSortingParams provided base, ApplyToSortItem backend allParams, Projectible be a, SqlOrderable be (BackendOrdering backend), ThreadRewritable (QNested s) a) => SortingSpec provided base -> (a -> SortingSpecApp backend allParams) -> Q be db (QNested s) a -> Q be db s (WithRewrittenThread (QNested s) s a) Source #
Applies orderBy_
according to the given sorting specification.