name: servant-util-beam-pg
description: 

For package maintainers and hackage trustees

Candidates



This package contains backend implementation for API combinators of servant-util package via &#39;beam-postgres&#39;.

Run stack build servant-util-beam-pg to build everything.

We will demonstrate this on the previously shown example:

Let&#39;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&#39;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!
license_spdx: MPL-2.0
version: 0.2
spec_version: 1.0
download_url: http://hackage.haskell.org/package/servant-util-beam-pg-0.2/servant-util-beam-pg-0.2.tar.gz
home_url: 
                
                  https://github.com/serokell/servant-util#readme
                
              
news_url: https://libraries.io/hackage/servant-util-beam-pg/versions.atom
date: 2021-12-25
about_resource: NONE
libraries_io_url: https://libraries.io/hackage/servant-util-beam-pg?number=0.2
vcs_tool: git
vcs_repository: https://github.com/serokell/servant-util
vcs_branch: master
