servant-db: Servant types for defining API with relational DBs

[ bsd3, library, unclassified ] [ Propose Tags ]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.2.0.0, 0.2.0.1
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5), servant (>=0.2 && <0.10) [details]
License BSD-3-Clause
Copyright 2016 (c) Anton Gushcha
Author Anton Gushcha
Maintainer ncrashed@gmail.com
Uploaded by NCrashed at 2016-10-14T09:53:10Z
Distributions
Reverse Dependencies 1 direct, 1 indirect [details]
Downloads 1496 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for servant-db-0.2.0.1

[back to package description]

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 type a.

  • ArgPos a - unamed argument of stored function of type a.

  • Procedure name a - named stored function with return type a.

Related libraries: