servant-util-beam-pg

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!


Keywords
library, mpl, program, servant, web, Propose Tags , Skip to Readme, , servant-util-beam-pg-0.4.1.tar.gz, browse, Package description, package maintainers, edit package information , previously shown example, CONTRIBUTING.md, Serokell, our other projects, hire us
License
MPL-2.0
Install
cabal install servant-util-beam-pg-0.4.1

Documentation

Serokell servant-util

Build status

Servant-util provides common primitives for building backends with Servant library.

Build Instructions

Run stack build to build everything.

Usage

Start from reading the core package usage that contains building blocks for your API and their simple implementations for a server backend. Efficient implementations based on specific types of storages are located in adjacent packages like servant-util-beam-pg.

For Contributors

Please see CONTRIBUTING.md for more information.

About Serokell

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!