yeshql: YesQL-style SQL database abstraction (legacy compatibility wrapper)

[ database, library, mit ] [ Propose Tags ]

Use quasi-quotations or TemplateHaskell to write SQL in SQL, while adding type annotations to turn SQL into well-typed Haskell functions.


[Skip to Readme]

Modules

[Last Documentation]

  • Database
    • Database.YeshQL

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.2.0.0, 0.2.0.1, 0.3.0.0, 0.3.0.2, 0.3.0.3, 1.0.0.0, 1.0.0.1, 2.0.0.0, 2.1.0.0, 2.2.0.0, 3.0.0.0, 3.0.0.1, 3.0.1.1, 3.0.1.2, 3.0.1.3, 4.1.0.0, 4.1.0.1, 4.1.1.2, 4.2.0.0
Dependencies base (>=4.6 && <5.0), yeshql-core (==4.1.1.2), yeshql-hdbc (==4.1.1.2) [details]
License MIT
Copyright 2015-2017 Tobias Dammers and contributors
Author Tobias Dammers
Maintainer tdammers@gmail.com
Category Database
Home page https://github.com/tdammers/yeshql
Bug tracker https://github.com/tdammers/yeshql/issues
Source repo head: git clone https://github.com/tdammers/yeshql.git
Uploaded by TobiasDammers at 2020-05-25T22:58:31Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 11325 total (72 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2020-05-26 [all 2 reports]

Readme for yeshql-4.2.0.0

[back to package description]

YeshQL

YesQL-style SQL database abstraction.

YeshQL implements quasiquoters that allow the programmer to write SQL queries in SQL, and embed these into Haskell programs using quasi-quotation. YeshQL takes care of generating suitable functions that will run the SQL queries against a HDBC database driver, and marshal values between Haskell and SQL.

In order to do this properly, YeshQL extends SQL syntax with type annotations and function names; other than that, it is perfectly ignorant about the SQL syntax itself. See the YesQL Readme for the full rationale - Haskell and Clojure are sufficiently different languages, but the reasoning behind YesQL applies to YeshQL almost unchanged.

Installation

Use stack or cabal to install. Nothing extraordinary here.

Usage

In short:

{-#LANGUAGE QuasiQuotes #-}
import MyProject.DatabaseConnection (withDB)
import Database.HDBC
import Database.YeshQL

[yesh|
  -- name:getUser :: (String)
  -- :userID :: Int
  SELECT username FROM users WHERE id = :userID
|] 

main = withDB $ \conn -> do
  username <- getUser 1 conn
  putStrLn username

Please refer to the Haddock documentation for further usage details.

Bugs

Probably. The project is hosted at https://github.com/tdammers/yeshql, feel free to comment there or send a message to tdammers@gmail.com if you find any.

Something about the name

YeshQL is rather heavily inspired by YesQL, so it makes sense to blatantly steal most of the name. Throwing in an "H" for good measure (this being Haskell and all) makes it sound like Sean Connery, which automatically increases aweshomenesh, so that'sh what we'll roll with.

License / Copying

YeshQL is Free Software and provided as-is. Please see the enclosed LICENSE file for details.

Legacy / Backwards-Compatibility Notice

Note that the yeshql package, starting with the 4.1 release, is now merely a wrapper around yeshql-core and yeshql-hdbc, re-exporting what is hopefully close enough to the original yeshql API to be somewhat compatible.

This is because starting with this release, yeshql has been split up into a frontend, which takes care of query parsing and the whole TemplateHaskell machinery, and several backends - at the time of writing, these are yeshql-hdbc, which uses HDBC just like the original yeshql package, and yeshql-postgresql-simpel, which uses postgresql-simple. With this architecture, it is possible to add more backends without affecting the frontend or any of the other backends.