Comments (16)
规范就这么多啊,原理就是将前端传的请求 JSON 转换为 SQL 语句,连接执行后返回 JSON 结果。
目前APIJSONBoot 基于 SpringBoot 做了几个自动化的 API,Controller 接收到请求 JSON 后交给APIJSONORM 这个 ORM 库的 Parser 解析,Parser再通过 SQLConfig 去生成 SQL 语句,最后返回给APIJSONBoot,APIJSONBoot 里的 SQLExecutor 子类再连接数据库执行,最后按原路径返回 JSON 结果。
这是实现原理的比较详细的说明
#6
from apijson.
NodeJS建议用koa2做中间件,相当于Java的SpringBoot,然后再将JSON转换为SQL语句
from apijson.
@TommyLemon 我自己写个一个类似的python的,用的SQLAlchemy通过json生成sql,现在有点烦自己设计规范。要不我把 APIJSON 规范抄了吧。
from apijson.
@zeromake 可以啊
from apijson.
@TommyLemon 看了一下实现规范说明有点杂乱。我现在的规范是抄的 leancloud。
from apijson.
设计规范 不是实现规范,而是对于达到某种效果的描述哦,具体怎么实现可不管,所以才能不局限于某种语言,目前因为我个人能力和精力问题,所以只实现了Java版的Server。
LeanCloud我很早就看过了,它增强了URL,但很复杂、不直观,用起来挺麻烦的,客户端的Model居然强制继承它的AVObject,不能继承别的或不继承,请求强制用它的AVQuery等类,非常不友好。
APIJSON协议的核心就是 引用赋值 ,它是实现对象之间关系描述的功能,对于MySQL,Oracle,MSSQL Server等关系型数据库非常适用,也是最难实现的部分。其它功能都是SQL语法用key:value表示的简单对应描述,实现也比较简单。
APIJSON的实现原理请参考
#6
如果你开发出来,我可以帮你推广下^_^
from apijson.
@TommyLemon 我不是说实现方式我是指,http的请求数据,如json的body对象转换为某种抽象的操作。
比如查询一个有条件过滤的表
# 查询id不等于1的列表
curl /user?where={"id": {"opt": "$ne", "val": 1}}
{
"status": 200,
"message": "ok",
"data": [
{
"id": 2,
"name": "test2"
},
...
]
}
以上的各种过滤表达式的说明。
=, !=, >,<, IN, NOT IN, LIKE之类的
还有批量操作也没看到请求该如何构建,比如批量修改。
大概就是指 sql 的对应到 http 上的请求的构建格式。
from apijson.
@zeromake 都支持啊,
http://apijson.cn:8080/get
{
"User[]": {
"count": 10, // LIMIT 0, 10
"User": { // FROM User
"@column": "id,name", // SELECT id,name
"name": "APIJSONUser", // WHERE name = 'APIJSONUser'
"name$": "A%", // WHERE name LIKE 'A%'
"id!": 38710, // WHERE id != '38710'
"id{}": [ // WHERE id IN ('1490109742863', '1490109845208', '1490420651686', '1493748615711')
1490109742863,
1490109845208,
1490420651686,
1493748615711
],
"id!{}": [ // WHERE id NOT IN ('1490584952968', '1492936169722')
1490584952968,
1492936169722
]
}
}
}
返回:
{
"User[]": [
{
"id": 1490109742863,
"name": "APIJSONUser"
},
{
"id": 1490109845208,
"name": "APIJSONUser"
},
{
"id": 1490420651686,
"name": "APIJSONUser"
},
{
"id": 1493748615711,
"name": "APIJSONUser"
}
],
"code": 200,
"msg": "success"
}
具体看通用文档中的 功能符
Java版的实现参考 AbstractSQLConfig
批量删改需要传 id{}:[] , tag一般是 Comemnt[] 这种带数组符号的 , 请参考文中的批量操作 后端开挂:3行代码写出8个接口!
from apijson.
from apijson.
@TommyLemon 我考虑下,研究套json api对应抽象数据库操作的说明,再考虑实现,我现在的用的是 leancloud
的规范,要改成 APIJSON
也不难。好像没有看到 OR
, AND
的对照 json 表现模式?
from apijson.
@zeromake APIJSON 不是 JSON API哦。
OR - | 或不写
AND - &
NOT - !
见功能符中的 逻辑运算
from apijson.
@TommyLemon 我说的 JSON API 是指各种数据库操作(APIJSON, leancloud)自动化转 json api 的各种规范的比较与说明。
from apijson.
@zeromake 好吧,上图就是了
from apijson.
就是想进来说下,很腻害!
from apijson.
@mlick 哈哈,感谢支持
from apijson.
from apijson.
Related Issues (20)
- [Xiaomi][Fortune 500] Linked APIJSON-Demo in its official Lark(by ByteDance) website
- [CHINA TELECOM][Fortune 500] China's biggest network provider CHINA TELECOM applied an OpenAPI patent for a low-code platform using APIJSON
- 两张表进行内链查询时,第二张表查询生成的库为默认sys HOT 7
- [Bug]字符 getMethodDefination(method,arguments,type,exceptions,language) 对应的远程函数 getMethodDefination(JSONObject request, String method, String arguments, String type, String exceptions, String language) 不在后端 apijson.demo.DemoFunctionParser 内,也不在父类中!如果需要则先新增对应方法! 请检查函数名和参数数量是否与已定义的函数一致! HOT 1
- [ORACLE] 子查询内部默认添加分页语句,导致in函数无法实现,提示Error Msg = ORA-00913: 值过多的报错 HOT 2
- 【AtlasMap】官网链接了 apijson-column
- [AtlasMap] official website linked apijson-column
- 文档醒目位置没有Getting started,没有说明如何运行这个项目 HOT 1
- [Bug] 达梦数据库做表左关联时提示有歧义的列名[RN] HOT 2
- 【Alibaba 阿里巴巴】【淘天集团】淘宝内网文档链接了 APIJSON
- [Alibaba][Fortune 500] taobao.com internal doc site linked APIJSON
- 希望新增“导出查询结果到excel”的功能 HOT 1
- 查询库表字段信息 HOT 2
- 请求信息中日期/时间的处理方法 HOT 1
- [Bug] 扩展@combine,同一个key在筛选/数据体中可同时存在,两者非互斥逻辑 HOT 4
- 【请教】将查询结果作为远程函数的入参 HOT 2
- [Bug] function校验失败和不允许 UNKNOWN 用户的 GET 请求 HOT 1
- 【问题咨询】响应结果的类型转换
- [Bug] SQL注入风险 HOT 6
- 当前版本如何生成自定义主键id,关于put和delete除id之外的其他条件 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apijson.