hasql

A minimalistic general high level API for relational databases

https://github.com/nikita-volkov/hasql

Version on this page:0.7.4
LTS Haskell 22.17:1.6.4.3
Stackage Nightly 2024-04-19:1.6.4.3
Latest on Hackage:1.6.4.3

See all snapshots hasql appears in

MIT licensed and maintained by Nikita Volkov
This version can be pinned in stack with:hasql-0.7.4@sha256:071d496a02031bfc78b87288e46919242152ab31fe4785931ef812cd2b6d0de0,5939

Module documentation for 0.7.4

A robust and concise yet powerful API for communication with arbitrary relational databases using SQL.

Features:

  • Concise and crisp API. Just a few functions and two monads doing all the boilerplate job for you.

  • A powerful transaction abstraction, which provides an automated resolution of conflicts. The API ensures that you're only able to perform a specific set of actions in the transaction context, which allows Hasql to safely resolve conflicting transactions by automatically retrying them. This is much inspired by STM and ST.

  • Support for cursors. Allows to fetch virtually limitless result sets in a constant memory using streaming.

  • Employment of prepared statements. Every statement you emit gets prepared and cached. This raises the performance of the backend.

  • Automated management of resources related to connections, transactions and cursors.

  • A built-in connection pool.

  • Compile-time generation of templates. You just can't write a statement with an incorrect number of placeholders.

  • Ability to map to any types actually supported by the backend.

Links:

Changes

0.7.3.1

  • Attoparsec-0.13 support

0.7.3

  • GHC 7.10 support

0.7.2

  • Implement support for free variables by the quasi-quoter

0.7.1

  • Relaxed the dependency on “monad-control”

0.7.0 - Refinements and minor updates

  • Streaming now is parameterized by the size of a chunk
  • Introduced a new type Ex
  • Changed the suffix of statement execution functions to Ex

0.6.0 - Major API overhaul

  • The connection pool acquisition is now explicit and is no longer handled by the Session monad. This should provide for a simpler integration with other libraries.
  • The Session monad is now merely a convenience thing for providing a context to multiple transactions. One can run it as many times as he wants - it won’t reestablish any resources any more.
  • The connection timeout is now set using Int for simplicity.
  • There are no exceptions any more. All the error-reporting is typed and done explicitly, using Either.
  • The error types are now mostly backend-specific.
  • The transaction mode is now extended to support uncommittable transactions with the TxWriteMode type.
  • All Tx functions are now appended with a “Tx” suffix.
  • Added vectorTx and maybeTx and updated the semantics of singleTx.
  • q statement quasi-quoter is now renamed to more meaningful stmt.
  • The Statement type is renamed to Stmt and is now exported from the main API.
  • RowParser is now uninstantiable. This enforces the idiomatic usage of the library.
  • Statement templates now support UTF-8.

0.5.0

  • Update the “list-t” and “monad-control” deps

0.4.1

  • Fix the transaction conflicts bug