postgresql-simple-interpolate alternatives and similar packages
Based on the "postgresql" category.
Alternatively, view postgresql-simple-interpolate alternatives based on common mentions on social networks and blogs.
-
postgresql-simple
Mid-level client library for accessing PostgreSQL from Haskell -
postgresql-simple-migration
PostgreSQL Schema Migrations for Haskell -
postgresql-orm
An Haskell ORM (Object Relational Mapping) and migrations DSL for PostgreSQL. -
postgresql-tx
[Moved to: https://github.com/Simspace/postgresql-tx] -
postgresql-typed
Haskell PostgreSQL library with compile-time type inference -
postgresql-transactional
Transactional monadic actions on top of PostgreSQL. -
postgresql-simple-named
:question: Implementation of named parameters for `postgresql-simple` library -
postgresql-libpq
Low-level Haskell bindings for libpq -
postgresql-pure
a PostgreSQL client library implemented with pure Haskell -
postgresql-schema
PostgreSQL Schema is a database migration tool. -
postgresql-syntax
PostgreSQL SQL syntax utilities -
postgresql-simple-typed
TypedQuery flavour for postgresql-simple -
postgresql-error-codes
PostgreSQL error codes -
postgresql-simple-opts
An optparse-applicative parser for postgresql-simple's connection options -
postgresql-placeholder-converter
Converter for question mark style and dollar sign style of PostgreSQL SQL. -
postgresql-libpq-notify
A postgresql notifications library for libpq -
postgresql-tx-simple
postgresql-tx interfacing for use with postgresql-simple. -
postgresql-lo-stream
Utilities for streaming PostgreSQL LargeObjects -
postgresql-tx-squeal
postgresql-tx interfacing for use with squeal-postgresql. -
postgresql-tx-monad-logger
postgresql-tx interfacing for use with monad-logger. -
postgresql-tx-query
postgresql-tx interfacing for use with postgresql-query.
Static code analysis for 29 languages.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of postgresql-simple-interpolate or a related project?
README
postgresql-simple-interpolate
Write natural SQL statements in Haskell using a QuasiQuotes!
{-# LANGUAGE QuasiQuotes #-}
import Data.Char (toLower)
import qualified Database.PostgreSQL.Simple as Pg
import Database.PostgreSQL.Simple.SqlQQ.Interpolated (isql)
import Control.Exception (bracket)
main :: IO ()
main = do
bracket (Pg.connectPostgreSQL "host=localhost") Pg.close $ \conn -> do
let limit = 10
ages <- uncurry (query conn) [isql|SELECT age FROM table WHERE name = ${map toLower "CLIVE"} LIMIT ${limit}|]
print (ages :: [Pg.Only Int])
|]
Hacking
With Nix you can quickly play around with this using a PostgreSQL database:
nix-shell -p '(import ./. {}).haskellPackages.ghcWithPackages (p: [p.gargoyle-postgresql-connect p.postgresql-simple-interpolate])' --run ghci
Then run
:set -XQuasiQuotes
import Gargoyle.PostgreSQL.Connect (withDb)
import Data.Pool (withResource)
import Database.PostgreSQL.Simple (Only (..), query)
import Database.PostgreSQL.Simple.SqlQQ.Interpolated (isql)
[isql|SELECT ${1 + 1}|]
-- ("SELECT ?",[Plain "2"])
withDb "db" $ \pool -> withResource pool $ \c -> (uncurry (query c) [isql|SELECT ${1 + 1}, ${reverse "HELLO"}::text|] :: IO [(Int, String)])
-- [(2,"OLLEH")]
Acknowledgements
This library is basically just a copy of the here
package by Taylor M. Hedberg with slight modifications!