serviette: JSON to raw Sql string

[ bsd3, deprecated, library, web ] [ Propose Tags ]
Deprecated

Use json to query the database and receive results


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

  • No current members of group

For package maintainers and hackage trustees

Candidates

Versions [RSS] 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) [details]
License BSD-3-Clause
Copyright 2017 Sasa Bogicevic
Author Sasa Bogicevic
Maintainer brutallesale@gmail.com
Category Web
Home page https://github.com/v0d1ch/serviette#readme
Source repo head: git clone https://github.com/v0d1ch/serviette
Uploaded by v0d1ch at 2017-06-17T13:18:25Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 3202 total (26 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-06-17 [all 1 reports]

Readme for serviette-0.1.0.4

[back to package description]

SERVIETTE - JSON to SQL

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 raw sql string back:

SELECT users join addresses on userid = users.id join posts on userid = users.id where users.id > 1

Work in progress

This works for SELECT statements, others need to be implemented as well as error and warning messages if the json does not contain what it should. You can find this lib on hackage Example usage with Yesod is here