The serviette package

[ Tags: bsd3, library, web ] [ Propose Tags ]

Use json to generate simple sql queries. I needed this for the work project and decided to implement it also in haskell. This could be used to query the database directly from frontend.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5, 0.1.0.6 (info)
Dependencies aeson, base (>=4.7 && <5), bytestring (>=0.9 && <0.11), generic-deriving, text (>=0.11 && <2.0), text-show [details]
License BSD3
Copyright 2017 Sasa Bogicevic
Author Sasa Bogicevic
Maintainer brutallesale@gmail.com
Category Web
Home page https://github.com/v0d1ch/serviette#readme
Source repository head: git clone https://github.com/v0d1ch/serviette
Uploaded Sat Jun 24 20:59:55 UTC 2017 by v0d1ch
Distributions NixOS:0.1.0.6
Downloads 286 total (18 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-06-24 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for serviette-0.1.0.6

[back to package description]

SERVIETTE - JSON to SQL Build Status

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 Serviette backend is here