Ecosyste.ms: Repos
An open API service providing repository metadata for many open source software ecosystems.
Package Usage: hackage: servant-util-beam-pg
[Last Documentation]
Package maintainers
For package maintainers and hackage trustees
Candidates
This package contains backend implementation for API combinators of servant-util package via 'beam-postgres'.
Run stack build servant-util-beam-pg to build everything.
We will demonstrate this on the previously shown example:
Let's assume that Book definition is extended to a Beam table (this is not necessary,
but simplifies our example):
Implementation will look like
Function sortingApp specifies how to correlate user-provided specification with fields
of our table. For each field which we allow to sort on, we specify a Beam field from the
table.
If one of the fields lacks such specification in sortingApp definition or order of
fields is incorrect then compile error is raised. The same happens when field types in API
and schema definition mismatch.
Annotating fieldSort calls with a field name is fully optional but may save you in case
when several fields of the same type participate in sorting; this also improves readability.
Filtering is implemented pretty much like sorting.
Let's consider the previously shown example:
Implementation can look like
Again, for each possible user-provided filter you have to provide an implementation.
Automatic filters require only a corresponding field of response, they will apply the required
operation to it themselves. On the other hand, manual filters carry the value that
user provides, and you implement the predicate on this value.
Again, type annotations in filterOn and manualFilter calls are optional.
Pagination can be applied simply with paginate_ function.
Please see CONTRIBUTING.md for more information.
Servant-util is maintained and funded with â¤ï¸ by Serokell. The names and logo for Serokell are trademark of Serokell OÃ.
We love open source software! See our other projects or hire us to design, develop and grow your idea!
7 versions
Latest release: over 1 year ago
509 downloads total
View more package details: https://packages.ecosyste.ms/registries/hackage.haskell.org/packages/servant-util-beam-pg
View more repository details: https://repos.ecosyste.ms/hosts/GitHub/repositories/serokell%2Fservant-util
Dependent Repos 1
serokell/servant-util
Servant servers utilities- * servant-util-beam-pg/servant-util-beam-pg.cabal
Size: 321 KB - Last synced: 20 days ago - Pushed: 20 days ago
serokell/edna
An open-source tool for data analysis aimed to help researchers with their experiments.- * backend/edna.cabal
Size: 2.37 MB - Last synced: about 1 month ago - Pushed: 6 months ago