typedquery alternatives and similar packages
Based on the "Database" category.
Alternatively, view typedquery alternatives based on common mentions on social networks and blogs.
-
erd
Translates a plain text description of a relational database schema to a graphical entity-relationship diagram. -
persistent-redis
Persistence interface for Haskell allowing multiple storage methods. -
squeal-postgresql
Squeal, a deep embedding of SQL in Haskell -
acid-state
Add ACID guarantees to any serializable Haskell data structure -
postgresql-simple
Mid-level client library for accessing PostgreSQL from Haskell -
esqueleto
Bare bones, type-safe EDSL for SQL queries on persistent backends. -
HDBC-session
This repository includes a joined query generator based on typefull relational algebra, and mapping tools between SQL values list and Haskell record type. -
groundhog
This library maps datatypes to a relational model, in a way similar to what ORM libraries do in OOP. See the tutorial https://www.schoolofhaskell.com/user/lykahb/groundhog for introduction -
hw-kafka-client
Kafka client for Haskell, including auto-rebalancing consumers -
mysql-simple
A mid-level client library for the MySQL database, intended to be fast and easy to use. -
postgresql-simple-migration
PostgreSQL Schema Migrations for Haskell -
vcache
large, persistent, memcached values and structure sharing for Haskell -
vcache-trie
large, persistent, memcached values and structure sharing for Haskell -
direct-sqlite
Low-level binding to SQLite3. Includes UTF8 and BLOB support. -
dbmigrations
A library for the creation, management, and installation of schema updates for relational databases. -
haskelldb
A library for building re-usable and composable SQL queries. -
postgresql-tx
[Moved to: https://github.com/Simspace/postgresql-tx] -
postgresql-typed
Haskell PostgreSQL library with compile-time type inference -
ampersand
Build database applications faster than anyone else, and keep your data pollution free as a bonus. -
postgresql-orm
An Haskell ORM (Object Relational Mapping) and migrations DSL for PostgreSQL. -
persistent-database-url
Parse DATABASE_URL into configuration types for Persistent
Clean code begins in your IDE with SonarLint
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of typedquery or a related project?
README
typedquery
Parser for SQL augmented with types
Till it finalised I would recomend installing it: with cabal -f debug-typed-queries
just to see what is gonig on.
As the SQL parser is not complete, and will need a major lift to make it readable and sane... however it works fine for all queries I need.
This package provides base parsing facilities for possibly all *-simple database packages converting them into *-simpel-typed
- https://github.com/tolysz/mysql-simple-typed
- https://github.com/tolysz/sqlite-simple-typed
- https://github.com/tolysz/postgresql-simple-typed
example: https://github.com/tolysz/sqlite-simple-typed/blob/master/example/src/Main.hs
The basic idea is to start using SQL again, but use comemnts (--
) to hide haskell annotation.
This started as QuasiQuotes
excercise with the TH inpired printf
.
genJsonQuery
produces[Value]
genTypedQuery
produces[(T1,...,Tn)]
tuples,[T]
or()
all depending on theSQL
query
If you do not provide value (or a mean to get on inside query you need to give it outside.
They do the same:
$(genJsonQuery "SET SESSION group_concat_max_len = ? ") conn (10000 :: Int)
$(genJsonQuery "SET SESSION group_concat_max_len = ? -- Int ") conn 10000
$(genJsonQuery "SET SESSION group_concat_max_len = ? -- Int -- < 1000 ") conn
$(genJsonQuery "SET SESSION group_concat_max_len = ? -- < (1000 :: Int) ") conn
There is a basic syntax, and the base idea is to have a nice easy for eye syntax.
It fires the correct execute
or query
with or without _
depending on the actual SQL
syntax
The parser is not complete, I will try to add as many issues there are and try to fix it.
Adnotations start with --
as otherwise HeidiSQL
was complaining, then >
<
~
or just text.
syntax | equivalent |
---|---|
bal -- Type |
(\v -> v :: Bla) |
bla -- > f |
(\v -> f bla ) |
bla -- Type -- > f |
(\v -> (f bla):: Type ) |
? -- Type -- < var |
?? |
? -- < var |
?? |
? -- < var |
?? |
? -- ~ verbatim |
?? |
Eg.
$(genJsonQuery [qq| insert into some_table
( timeAsSQLfunction -- ~ now ()
, someInputfromAesonViaLens -- Int -- < v ^? (key "coolValue" . _Integral) ^. non 3
, someUserName -- Text -- < someNameFromContext
) |]) conn
Translates to
execute conn [qq| insert into some_table
( timeAsSQLfunction, someInputfromAesonViaLens, someUserName )
values ( now (), ?, ?) |]
[( (v ^? (key "coolValue" . _Integral) ^. non 3 ) :: Int, someNameFromContext Text)]