https://github.com/v0d1ch/serviette
JSON to SQL lib
https://github.com/v0d1ch/serviette
haskell json serviette sql sql-query
Last synced: 3 months ago
JSON representation
JSON to SQL lib
- Host: GitHub
- URL: https://github.com/v0d1ch/serviette
- Owner: v0d1ch
- License: bsd-3-clause
- Created: 2017-03-16T22:49:26.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-26T14:51:28.000Z (over 8 years ago)
- Last Synced: 2025-08-18T09:52:53.357Z (6 months ago)
- Topics: haskell, json, serviette, sql, sql-query
- Language: Haskell
- Homepage:
- Size: 264 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SERVIETTE - JSON to SQL [](https://travis-ci.org/v0d1ch/serviette) [](https://hackage.haskell.org/package/serviette)
Library for generating SQL queries from JSON.
Send the json in the expected format and receive raw sql string.
### Why ?
- Why not ?
### Expected JSON format
````
{
"format":1,
"action":"SELECT",
"selectName": "users",
"joinTables":[
{"tablename":"addresses","field":"userid","operator":"=","withTable":"users", "withField":"id"},
{"tablename":"posts","field":"userid","operator":"=","withTable":"users", "withField":"id"}
],
"whereCondition":[
{"whereTableName":"users","whereField":"id", "whereOperator":">", "whereFieldValue": 1}
]
}
````
If `format` is set to 1 you will get json response:
````
{"response":"SELECT users join addresses on userid = users.id join posts on userid = users.id where users.id > 1","warnings":"","errors":""}
````
You can find this lib on [hackage](https://hackage.haskell.org/package/serviette)
Serviette backend is [here](https://github.com/v0d1ch/serviette-yesod-example)