servant-util-beam-pg (hackage):   [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!
Keywords: database|library|mpl|program|servant|web