{"repo":"nikita-volkov/hasql-th","free":true,"listed":false,"github":"https://github.com/nikita-volkov/hasql-th","clone":"git clone https://github.com/nikita-volkov/hasql-th.git","description":"Template Haskell utilities for Hasql","language":"Haskell","stars":116,"topics":["hasql","haskell","postgresql"],"license":"MIT","category":"databases-storage","readme_excerpt":"Summary An extension library for the \"hasql\" Postgres driver, bringing compile-time syntax checking of queries atop of a great simplification of declaration of statements. All the user needs to do is just specify SQL. Here's a brief example of how it works: Note: these quasiquoters require the QuasiQuotes language extension. In a Haskell module, add {-# LANGUAGE QuasiQuotes #-} ; in GHCi, run :set -XQuasiQuotes . As you can see, it completely eliminates the need to deal with codecs. The quasiquoters directly produce Statement , which you can then dimap over using its Profunctor instance to get to your domain types. Examples of mapping to custom types Using some Haskell's advanced techniques and the \"tuple\" library we can reduce the boilerplate in the previous definition: Status The library supports almost all of Postgresql syntax available for preparable statements. This includes Select, Insert, Update and Delete among others. The only thing that is not supported yet is some of its very rarely used XML-related features. Quality The parser and renderer get heavily tested using the following property: rendering a random AST then parsing it should produce the same AST. This pretty much covers most possible reasons for bugs in the library. Implementation This library internally implements a port of the original Postgres SQL syntax parser. It might sound like an overkill, but there really were no better options. Unfortunately Postgres doesn't export it's own parser in any of its d","default_branch":null,"files":null,"tree":[],"storefront":"/r/nikita-volkov","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/nikita-volkov/hasql-th/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}