Popularity
4.1
Stable
Activity
0.0
Stable
3
5
0
Monthly Downloads: 2
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
hasql-simple alternatives and similar packages
Based on the "hasql" category.
Alternatively, view hasql-simple alternatives based on common mentions on social networks and blogs.
Do you think we are missing an alternative of hasql-simple or a related project?
README
hasql-simple
A somewhat opinionated "simpler" API to hasql. This allows to write code like:
import Hasql.Query
import Hasql.Simple
import qualified Hasql.Decoders as D
data NewUser
= NewUser
{ nu_username :: !T.Text
, nu_email :: !T.Text
, nu_password :: !(Password 'PtHash)
} deriving (Show)
createUserQ :: Query NewUser UserId
createUserQ =
statement sql encoder decoder True
where
sql =
"INSERT INTO login (username, email, password) VALUES ($1, $2, $3) RETURNING id;"
encoder =
req nu_username
<> req nu_email
<> req nu_password
decoder =
D.singleRow dbDecVal
The -simple
in the name is due to this type class approach beeing similar to the one found in postgresql-simple
. All contributions (e.g. more instances and/or helper functions) are welcome, please send a PR.