-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
## SQL-Builder | ||
|
||
Through the SQL-Buider you can build a response based on multiple SQL queries. | ||
You can use a specialised JSON format to specify the SQL queries and the | ||
response format. | ||
|
||
### Elements | ||
|
||
#### Collection | ||
|
||
All elements which contain an `!collection` key are replaced with an array. The | ||
array contains for each result an object in the format of the definition. | ||
|
||
{ | ||
"!collection": "SELECT id, title, content, date FROM app_news ORDER BY id DESC", | ||
"definition": { | ||
"displayTitle": "title", | ||
"createDate": "date|datetime", | ||
} | ||
} | ||
|
||
#### Entity | ||
|
||
All elements which contain an `!entity` key are replaced with an object. The | ||
object has the format of the definition. | ||
|
||
{ | ||
"!entity": "SELECT id, name, date FROM app_author WHERE id = :authorId" | ||
"parameters": {"authorId": "$authorId"}, | ||
"definition": { | ||
"displayName": "name", | ||
"insertDate": "date|datetime" | ||
} | ||
} | ||
|
||
#### Value | ||
|
||
All elements which contain an `!value` key are replaced with a single value. | ||
|
||
{ | ||
"!value": "SELECT COUNT(*) FROM app_news" | ||
} | ||
|
||
### Example | ||
|
||
{ | ||
"totalResults": { | ||
"!value": "SELECT COUNT(*) FROM app_news" | ||
}, | ||
"entry": { | ||
"!collection": "SELECT id, title, content, date FROM app_news ORDER BY id DESC", | ||
"definition": { | ||
"id": "id|integer", | ||
"title": "title", | ||
"date": "date|datetime" | ||
} | ||
} | ||
} | ||
|
||
|
||
|