Git Product home page Git Product logo

Comments (8)

TommyLemon avatar TommyLemon commented on April 28, 2024

@cnlinjie 感谢你的关注。
1.APIJSON对自动生成的SQL语句做了优化,但确实不能在某些场景下做到最优,所以开发效率和运行性能需要使用者自己权衡。建议先用APIJSON实现,反正成本极低。测试过性能后,如果不符合需求就自己优化。
2.可以通过 "@about":true 来查询,而且这个文档是直接用数据库字段自动生成的(而不是人写的独立的文档),相当稳定不会出错。
3.如果是不同服务器,访问不同的URL就行了。如果是同一个服务器的不同数据库schema,可以用 "@Schema":schema 标记。(应该是小写,GitHub把@ 后的内容转成大写了)

最后,确实所有从外面进来的数据都是不可信的,APIJSON支持对请求内容方便地进行各种校验。你说这个例子是误解了这段话,最后一次是指 前端/客户端 不应该把明显有问题的数据提交到服务器,增加服务器压力。例如 用手机号登录,手机号格式是否合法后端虽然也会校验,不合法就返回报错,但前端/客户端在请求前就应该校验,只有所有输入都没有明显错误的前提下才发请求。这时服务器仍然会对手机号格式等校验,但只有最后一次,而不是每次用户点击登录不管对不对都发到服务器去校验。所以前面有明显错误的时候都能“无延时响应”。

from apijson.

TommyLemon avatar TommyLemon commented on April 28, 2024

@cnlinjie 公司已经在用自动化在线文档了

{
	"Comment[]": {
		"Comment": {
			"@about": true
		}
	}
}

返回:

{
	"Comment[]": [
		{
			"column_name": "id",
			"column_type": "bigint(15)",
			"is_nullable": "NO",
			"column_comment": "唯一标识"
		},
		{
			"column_name": "toId",
			"column_type": "bigint(15)",
			"is_nullable": "YES",
			"column_comment": "回复的评论id"
		},
		{
			"column_name": "userId",
			"column_type": "bigint(15)",
			"is_nullable": "NO",
			"column_comment": "发布评论的用户id"
		},
		{
			"column_name": "momentId",
			"column_type": "bigint(15)",
			"is_nullable": "NO",
			"column_comment": "对应的动态id"
		},
		{
			"column_name": "time",
			"column_type": "timestamp",
			"is_nullable": "YES",
			"column_default": "CURRENT_TIMESTAMP",
			"column_comment": "发布时间"
		},
		{
			"column_name": "content",
			"column_type": "varchar(1000)",
			"is_nullable": "NO",
			"column_comment": "内容"
		}
	],
	"code": 200,
	"msg": "success"
}

通过这个数据生成了字段说明表格嘿嘿。

from apijson.

cnlinjie avatar cnlinjie commented on April 28, 2024

感谢,回复晚了。
我研究下,在个人私单中参与使用,感谢作者。

from apijson.

TommyLemon avatar TommyLemon commented on April 28, 2024

@cnlinjie 哈哈,这个场景可以的。APIJSON通用接口(get,post,put,delete等)适用范围是 简单的增删改查操作、复杂的查询操作、简单的事务型操作,可以替代80%左右的传统接口(互联网应用一般能到85%-90%,ERP等管理系统会低一些)。APIJSON能很好地兼容传统接口,不适用的接口建议还是用传统方式做,例如APIJSON Server Demo里的注册、登录、验证码等接口就是用传统方式实现的。

from apijson.

TommyLemon avatar TommyLemon commented on April 28, 2024

@cnlinjie 看看这个,自动生成markdown文档,可展开/收起的带高亮格式化JSON,嘿嘿
http://apijson.cn/

from apijson.

TommyLemon avatar TommyLemon commented on April 28, 2024

@cnlinjie
已支持自动化的 join。
例如
Moment INNER JOIN User LEFT JOIN Comment:

"[]":{
   "join": "&/User/id@,</Comment/momentId@",
   "Moment":{},
   "User":{
     "name?":"t",
     "id@": "/Moment/userId"
   },
   "Comment":{
     "momentId@": "/Moment/id"
   }
}

详情见 通用文档/3.2 功能符/数组关键词 中的 join,感谢支持^_^
https://github.com/TommyLemon/APIJSON/blob/master/Document.md#3.2

from apijson.

cnlinjie avatar cnlinjie commented on April 28, 2024

收到,感谢哈。

from apijson.

TommyLemon avatar TommyLemon commented on April 28, 2024

@cnlinjie 目前最新版 5.0.0:

增强各种功能;腾讯负责人公开称赞;登记万科发起的采筑电商
https://github.com/Tencent/APIJSON/releases/tag/5.0.0

from apijson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.