esqueleto

Type-safe EDSL for SQL queries on persistent backends.

https://github.com/prowdsponsor/esqueleto

Version on this page:2.1.3
LTS Haskell 22.40:3.5.13.0
Stackage Nightly 2024-11-04:3.5.13.0
Latest on Hackage:3.5.13.0

See all snapshots esqueleto appears in

BSD-3-Clause licensed by Felipe Lessa
Maintained by [email protected]
This version can be pinned in stack with:esqueleto-2.1.3@sha256:dfd69fa0c91d5e8f4f11c3b92b81318266ff6305ee90cbdd70d50c9e4f7c5936,4077

Module documentation for 2.1.3

This version is a beta release that works with the persistent-2.0 beta.

esqueleto is a bare bones, type-safe EDSL for SQL queries that works with unmodified persistent SQL backends. Its language closely resembles SQL, so you don't have to learn new concepts, just new syntax, and it's fairly easy to predict the generated SQL and optimize it for your backend. Most kinds of errors committed when writing SQL are caught as compile-time errors---although it is possible to write type-checked esqueleto queries that fail at runtime.

persistent is a library for type-safe data serialization. It has many kinds of backends, such as SQL backends (persistent-mysql, persistent-postgresql, persistent-sqlite) and NoSQL backends (persistent-mongoDB). While persistent is a nice library for storing and retrieving records, including with filters, it does not try to support some of the features that are specific to SQL backends. In particular, esqueleto is the recommended library for type-safe JOINs on persistent SQL backends. (The alternative is using raw SQL, but that's error prone and does not offer any composability.)

Currently, SELECTs, UPDATEs, INSERTs and DELETEs are supported. Not all SQL features are available, but most of them can be easily added (especially functions), so please open an issue or send a pull request if you need anything that is not covered by esqueleto on https://github.com/prowdsponsor/esqueleto/.

The name of this library means "skeleton" in Portuguese and contains all three SQL letters in the correct order =). It was inspired by Scala's Squeryl but created from scratch.