https://github.com/stardustdl/db2api
A demo tool to provide a common, config-based Web API query interface for relational databases with access control.
https://github.com/stardustdl/db2api
Last synced: 21 days ago
JSON representation
A demo tool to provide a common, config-based Web API query interface for relational databases with access control.
- Host: GitHub
- URL: https://github.com/stardustdl/db2api
- Owner: StardustDL
- Created: 2023-06-26T02:15:00.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-08-02T11:14:33.000Z (over 1 year ago)
- Last Synced: 2025-02-07T13:51:34.302Z (2 months ago)
- Language: Java
- Homepage:
- Size: 1.07 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 
A demo tool to provide a common, config-based Web API query interface for relational databases with access control.
Collaborated with @CoolChameleon , @doubley318 , and @TeresaYT .
> As an entry of the 7th CMB FinTech Camp.
## Demo






## API Spec
### Add
```json
{
"user": {
"name": "userName",
"password": "userPassword",
},
"name": "table_name",
"value": {
"col1": "value1",
"col2": "value2",
}
}
```### Update
```json
{
"method": "update",
"user": {
"name": "userName",
"password": "userPassword",
},
"name": "table_name",
"cond": "where clause expression",
"value": {
"col1": "value1",
"col2": "value2",
}
}
```### Delete
```json
{
"method": "delete",
"user": {
"name": "userName",
"password": "userPassword",
},
"name": "table_name",
"cond": "where clause expression",
}
```### Query
```json
{
"method": "query",
"user": {
"name": "userName",
"password": "userPassword",
},
"name": "table_name",
"cond": "where clause expression",
// "sort": null // for no sorting
// + for asc, - for desc
"sort": "col1+,col2-,col3+",
// "page": null // for no pagination
"page": "pageNumber@pageSize", // eg. 2@5 second page, each page including 5 rows
// "group": null // for no grouping
"group": "colName",
"cols": [
"col1",
"SUM:col2", // aggr query
],
// join query, for single table query, do NOT add following attributes
"joinTable": "join_table_name",
"joinCond": "join on clause expression",
}
```### Config
```json
{
"GlobalConfig": [
{
"table_name": "TableName",
"name": "AliasName",
"add": true,
"delete": true,
"update": true,
"get": true,
}
],
"UserConfig": [
{
"name": "UserName",
"password": "Userpassword",
"OperationConfig": [
{
"table_name": "TableName",
"name": "AliasName",
"add": true,
"update": true,
"delete": true,
"get": true,
}
]
}
]
}
```## Build
```sh
gradle build
```## Run
```sh
gradle run
```