tchoutri/pg-entity
tchoutri/pg-entity has 42 GitHub stars and 10 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-12 18:20 UTC. Last push 2026-09-14.
Comment ces chiffres sont mesurés
A pleasant PostgreSQL database layer for Haskell
Progression mesurée des étoiles
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- Mise à jour retardée
- in 1 month
- Mise à jour retardée
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
Originalpg-entity
This library is a pleasant layer on top of postgresql-simple to safely expand the fields of a table when
writing SQL queries.
It aims to be a convenient middle-ground between rigid ORMs and hand-rolled SQL query strings. Here is its philosophy:
- The serialisation/deserialisation part is left to the consumer, so you have to go with your own FromRow/ToRow instances. You are encouraged to adopt data types in your application that model your business domain, rather than restrict yourself within the limits of what an SQL schema can represent. Use an intermediate Data Access Object (DAO) that can easily be serialised and deserialised to and from a SQL schema, to and from which you will morph your business data-types.
- Illegal states are made harder (but not impossible) to represent. Generic deriving of entities is encouraged, and quasi-quoters are provided to denote fields in a safer way.
- Escape hatches are provided at every level. The types that are manipulated are Query for which an
IsStringinstance exists. Don't force yourself to use the higher-level API if the lower-level combinators work for you, and if those don't either, “Just Write SQL”™.
Its dependency footprint is optimised for my own setups, and as such it makes use of text, vector and pg-transact.
Table of Contents
Documentation
This library aims to be thoroughly tested, by the means of Oleg Grenrus' cabal-docspec and more traditional tests for database roundtrips.
I aim to produce and maintain a decent documentation, therefore do not hesitate to raise an issue if you feel that something is badly explained and should be improved.
Escape hatches
Safe SQL generation is a complex subject, and it is far from being the objective of this library. The main topic it addresses is listing the fields of a table, which is definitely something easier. This is why every level of this wrapper is fully exposed, so that you can drop down a level at your convience.
It is my personal belief, firmly rooted in experience, that we should not aim to produce statically-checked SQL and have it "verified" by the compiler. The techniques that would allow that in Haskell are still far from being optimised and ergonomic. As such, this library makes no effort to produce semantically valid SQL queries, because one would have to encode the semantics of SQL in the type system (or in a rule engine of some sort), and this is clearly not the kind of things I want to spend my youth on.
Each function is tested for its output with doctests, and the ones that cannot (due to database connections) are tested in the more traditional test-suite.
The conclusion is : Test your DB queries. Test the encoding/decoding. Make roundtrip tests for your data-structures.
Acknowledgements
I wish to thank
- Clément Delafargue, whose anorm-pg-entity library and its initial port in Haskell are the spiritual parents of this library
- Koz Ross, for his piercing eyes and his immense patience
- Joe Kachmar, who enlightened me many times
Explorer des projets similaires
Asabeneh/30-Days-Of-Python
Le défi de programmation 30 Days of Python est un guide pas à pas pour apprendre le langage de programmation Python en 30 jours. Ce défi peut prendre plus de 100 jours. Avancez à votre rythme. Ces vidéos peuvent aussi vous aider : https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,618 étoilesgrafana/grafana
Plateforme ouverte et composable d’observabilité et de visualisation de données. Visualise les métriques, les journaux et les traces issus de plusieurs sources, comme Prometheus, Loki, Elasticsearch, InfluxDB, Postgres et bien d’autres.
77,859 étoilesredis/redis
Pour les développeurs qui créent des applications en temps réel pilotées par les données, Redis est le cache, le serveur de structures de données et le moteur de requêtes documentaires et vectorielles préféré, le plus rapide et le plus riche en fonctionnalités.
77,472 étoilesapache/superset
Apache Superset est une plateforme de visualisation et d'exploration de données.
75,495 étoiles