Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides base for filtering backend implementations.
Synopsis
- class FilterBackend backend where
- type AutoFilteredValue backend a
- type MatchPredicate backend
- type AutoFilterImpl backend a = AutoFilteredValue backend a -> MatchPredicate backend
- data FilteringApp backend param where
- AutoFilteringApp :: Typeable a => AutoFilteredValue backend a -> FilteringApp backend ('TyNamedParam name ('AutoFilter a))
- ManualFilteringApp :: Typeable a => (a -> MatchPredicate backend) -> FilteringApp backend ('TyNamedParam name ('ManualFilter a))
- class (Typeable filter, FilterBackend backend) => AutoFilterSupport backend filter a where
- autoFilterSupport :: filter a -> AutoFilterImpl backend a
- type FilteringSpecApp backend params = HList (FilteringApp backend) params
- class FilterBackend backend => BackendApplySomeFilter backend (params :: [TyNamedFilter])
- typeAutoFiltersSupport :: forall backend a. TypeAutoFiltersSupport backend a => SomeTypeAutoFilter a -> AutoFilterImpl backend a
- backendApplyFilters :: forall backend params. BackendApplySomeFilter backend params => FilteringSpec params -> FilteringSpecApp backend params -> [MatchPredicate backend]
- filterOn :: forall name backend a. Typeable a => AutoFilteredValue backend a -> FilteringApp backend ('TyNamedParam name ('AutoFilter a))
- manualFilter :: forall name backend a. Typeable a => (a -> MatchPredicate backend) -> FilteringApp backend ('TyNamedParam name ('ManualFilter a))
Filtering backend
class FilterBackend backend Source #
Implementation of filtering backend.
type AutoFilteredValue backend a Source #
The part of object which we are filtering on, provided by server backend implementor.
type MatchPredicate backend Source #
A resulting predicate.
type AutoFilterImpl backend a = AutoFilteredValue backend a -> MatchPredicate backend Source #
Implementation of auto filter we provide.
data FilteringApp backend param where Source #
How to apply a filter - what server backend implementor provides.
AutoFilteringApp :: Typeable a => AutoFilteredValue backend a -> FilteringApp backend ('TyNamedParam name ('AutoFilter a)) | |
ManualFilteringApp :: Typeable a => (a -> MatchPredicate backend) -> FilteringApp backend ('TyNamedParam name ('ManualFilter a)) |
class (Typeable filter, FilterBackend backend) => AutoFilterSupport backend filter a where Source #
Implementation of given auto filter type for Beam Postgres backend.
autoFilterSupport :: filter a -> AutoFilterImpl backend a Source #
Apply given filter to a value.
type FilteringSpecApp backend params = HList (FilteringApp backend) params Source #
Enlists a way to apply each of supported filters at target application backend.
class FilterBackend backend => BackendApplySomeFilter backend (params :: [TyNamedFilter]) Source #
Lookups for an appropriate filter application in a given FilteringSpecApp
and applies it to a given filter.
backendApplySomeFilter'
Instances
FilterBackend backend => BackendApplySomeFilter (backend :: k) ('[] :: [TyNamedFilter]) Source # | |
Defined in Servant.Util.Combinators.Filtering.Backend backendApplySomeFilter' :: FilteringSpecApp backend '[] -> SomeFilter '[] -> Maybe (MatchPredicate backend) | |
(Typeable fk, Typeable a, FilterBackend backend, KnownSymbol name, BackendApplyTypeFilter backend fk a, BackendApplySomeFilter backend params) => BackendApplySomeFilter (backend :: k) ('TyNamedParam name (fk a) ': params) Source # | |
Defined in Servant.Util.Combinators.Filtering.Backend backendApplySomeFilter' :: FilteringSpecApp backend ('TyNamedParam name (fk a) ': params) -> SomeFilter ('TyNamedParam name (fk a) ': params) -> Maybe (MatchPredicate backend) |
typeAutoFiltersSupport :: forall backend a. TypeAutoFiltersSupport backend a => SomeTypeAutoFilter a -> AutoFilterImpl backend a Source #
Safely choose an appropriate filter from supported ones and prepare it for application.
backendApplyFilters :: forall backend params. BackendApplySomeFilter backend params => FilteringSpec params -> FilteringSpecApp backend params -> [MatchPredicate backend] Source #
Applies multiple filters to a set of response fields which matter for filtering.
Server backend implementor API
filterOn :: forall name backend a. Typeable a => AutoFilteredValue backend a -> FilteringApp backend ('TyNamedParam name ('AutoFilter a)) Source #
Implement an automatic filter. User-provided filtering operation will do filter on this value.
manualFilter :: forall name backend a. Typeable a => (a -> MatchPredicate backend) -> FilteringApp backend ('TyNamedParam name ('ManualFilter a)) Source #
Implement a manual filter. You are provided with a value which user supplied and so you have to construct a Beam predicate involving that value and relevant response fields.