@hackage servant-db0.2.0.1
Servant types for defining API with relational DBs
Categories
License
BSD-3-Clause
Maintainer
ncrashed@gmail.com
Links
- Documentation
- No source repository
- Changelog
- Security
Versions
Installation
Dependencies (2)
Dependents (1)
@hackage/servant-db-postgresql
servant-db
The idea of package is to provide servant-like DSL for specifying an API for functions stored in RDBMS.
data RegisterUser = RegisterUser {
userName :: Text
, userPassword :: Text
, userPhone :: Phone
, userEmail :: Email
}
type API =
ArgNamed "user" RegisterUser
:> ArgNamed "isAdmin" Bool
:> Procedure "registerUser" (Maybe (Only UserId))
:<|> ArgPos UserId
:> Procedure "getUser" (Maybe User)
:<|> Procedure "listUsers" [User]
The library adds three custom combinators:
-
ArgNamed name a- named argument of stored function of typea. -
ArgPos a- unamed argument of stored function of typea. -
Procedure name a- named stored function with return typea.
Related libraries:
- servant-db-postgresql - derives client for PostgreSQL with postgresql-query library.