servant-db

Servant types for defining API with relational DBs

Latest on Hackage:0.2.0.1

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed by Anton Gushcha
Maintained by ncrashed@gmail.com

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:

Changes

0.2.0.1

  • Fix Servant.API.DB.Procedure documentation.

0.2.0.0

  • Split Arg to ArgNamed and ArgPos.

  • Add Default type wrapper.

0.1.0.0

  • Initial release
Depends on:
Used by 1 package:
comments powered byDisqus