├── assets ├── a ├── 1542255627809.png ├── 1542338464474.png ├── 1542345654422.png ├── 1542345887787.png ├── 1542350018926.png ├── 1542350219020.png ├── 1542357146401.png ├── 1542357265371.png ├── 1543975054594.png ├── 1543975563775.png ├── 1543975563776.png ├── 1543978123163.png ├── 1543983739325.png ├── 1543983787388.png ├── 1544515879364.png ├── 1544659314099.png ├── 1545468294295.png ├── 1545468341131.png └── 1545468361962.png ├── APIJSONORM ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── apijson │ │ ├── orm │ │ ├── package-info.java │ │ ├── model │ │ │ ├── package-info.java │ │ │ ├── Access.java │ │ │ ├── Script.java │ │ │ ├── Function.java │ │ │ ├── Request.java │ │ │ ├── PgClass.java │ │ │ ├── PgAttribute.java │ │ │ ├── Table.java │ │ │ ├── Column.java │ │ │ ├── SysTable.java │ │ │ ├── AllTable.java │ │ │ ├── SysColumn.java │ │ │ ├── AllColumn.java │ │ │ ├── AllTableComment.java │ │ │ ├── ExtendedProperty.java │ │ │ ├── AllColumnComment.java │ │ │ ├── TestRecord.java │ │ │ └── Document.java │ │ ├── exception │ │ │ ├── package-info.java │ │ │ ├── ConflictException.java │ │ │ ├── OutOfRangeException.java │ │ │ ├── NotExistException.java │ │ │ ├── NotLoggedInException.java │ │ │ ├── ConditionErrorException.java │ │ │ ├── UnsupportedDataTypeException.java │ │ │ └── CommonException.java │ │ ├── Visitor.java │ │ ├── VerifierCreator.java │ │ ├── SQLCreator.java │ │ ├── ParserCreator.java │ │ ├── script │ │ │ ├── ScriptExecutor.java │ │ │ ├── JavaScriptExecutor.java │ │ │ └── JSR223ScriptExecutor.java │ │ ├── Entry.java │ │ ├── OnParseCallback.java │ │ ├── FunctionParser.java │ │ ├── Subquery.java │ │ ├── Verifier.java │ │ ├── Operation.java │ │ ├── Logic.java │ │ ├── SQLExecutor.java │ │ ├── Parser.java │ │ ├── JSONRequest.java │ │ ├── ObjectParser.java │ │ ├── Pair.java │ │ ├── Join.java │ │ └── SQLConfig.java │ │ ├── package-info.java │ │ ├── JSONParser.java │ │ ├── NotNull.java │ │ ├── JSONCreator.java │ │ ├── MethodAccess.java │ │ ├── RequestMethod.java │ │ ├── Log.java │ │ ├── JSONRequest.java │ │ ├── JSONList.java │ │ ├── SQL.java │ │ └── JSONResponse.java ├── pom.xml └── README.md ├── .github └── ISSUE_TEMPLATE │ ├── config.yml │ ├── feature_request.yml │ ├── other_issues.yml │ └── bug_report.yml ├── logo.png ├── APIJSON初期构思及实现.docx ├── APIJSON初期构思及实现.pages ├── .gitignore ├── CONTRIBUTING_COMMIT.md ├── Navigation.md ├── CONTRIBUTING.md ├── LICENSE └── Roadmap.md /assets/a: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /APIJSONORM/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/logo.png -------------------------------------------------------------------------------- /APIJSON初期构思及实现.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/APIJSON初期构思及实现.docx -------------------------------------------------------------------------------- /APIJSON初期构思及实现.pages: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/APIJSON初期构思及实现.pages -------------------------------------------------------------------------------- /assets/1542255627809.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1542255627809.png -------------------------------------------------------------------------------- /assets/1542338464474.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1542338464474.png -------------------------------------------------------------------------------- /assets/1542345654422.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1542345654422.png -------------------------------------------------------------------------------- /assets/1542345887787.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1542345887787.png -------------------------------------------------------------------------------- /assets/1542350018926.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1542350018926.png -------------------------------------------------------------------------------- /assets/1542350219020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1542350219020.png -------------------------------------------------------------------------------- /assets/1542357146401.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1542357146401.png -------------------------------------------------------------------------------- /assets/1542357265371.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1542357265371.png -------------------------------------------------------------------------------- /assets/1543975054594.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1543975054594.png -------------------------------------------------------------------------------- /assets/1543975563775.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1543975563775.png -------------------------------------------------------------------------------- /assets/1543975563776.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1543975563776.png -------------------------------------------------------------------------------- /assets/1543978123163.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1543978123163.png -------------------------------------------------------------------------------- /assets/1543983739325.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1543983739325.png -------------------------------------------------------------------------------- /assets/1543983787388.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1543983787388.png -------------------------------------------------------------------------------- /assets/1544515879364.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1544515879364.png -------------------------------------------------------------------------------- /assets/1544659314099.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1544659314099.png -------------------------------------------------------------------------------- /assets/1545468294295.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1545468294295.png -------------------------------------------------------------------------------- /assets/1545468341131.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1545468341131.png -------------------------------------------------------------------------------- /assets/1545468361962.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/APIJSON/HEAD/assets/1545468361962.png -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/package-info.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | /** 7 | * server files package 8 | */ 9 | /** 10 | * @author Lemon 11 | * 12 | */ 13 | package apijson.orm; -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/package-info.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | /** 7 | * models for special tables 8 | */ 9 | /** 10 | * @author Lemon 11 | * 12 | */ 13 | package apijson.orm.model; -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/package-info.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | /** 7 | * the same files for server and client projects 8 | */ 9 | /** 10 | * @author Lemon 11 | * 12 | */ 13 | package apijson; -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/exception/package-info.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | /** 7 | * exception files package 8 | */ 9 | /** 10 | * @author Lemon 11 | * 12 | */ 13 | package apijson.orm.exception; -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/Access.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**访问权限 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class Access { 15 | } -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/Script.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**代码脚本 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class Script { 15 | } -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/Function.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**远程函数 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class Function { 15 | } -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/Request.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**请求处理 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class Request { 15 | } 16 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/Visitor.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm; 7 | 8 | import java.util.List; 9 | 10 | /**来访者 11 | * @author Lemon 12 | */ 13 | public interface Visitor { 14 | 15 | T getId(); 16 | 17 | List getContactIdList(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/PgClass.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**PostgreSQL 表属性 11 | * @author Lemon 12 | */ 13 | @MethodAccess 14 | public class PgClass { 15 | public static final String TAG = "PgClass"; 16 | public static final String TABLE_NAME = "pg_class"; 17 | 18 | } -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/PgAttribute.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**PostgreSQL 字段属性 11 | * @author Lemon 12 | */ 13 | @MethodAccess 14 | public class PgAttribute { 15 | public static final String TAG = "PgAttribute"; 16 | public static final String TABLE_NAME = "pg_attribute"; 17 | 18 | } -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/Table.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**表属性 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class Table { 15 | public static final String TAG = "Table"; 16 | public static final String TABLE_NAME = "tables"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/Column.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**字段(列名)属性 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class Column { 15 | public static final String TAG = "Column"; 16 | public static final String TABLE_NAME = "columns"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/SysTable.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**SQL Server 表属性 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class SysTable { 15 | public static final String TAG = "SysTable"; 16 | public static final String TABLE_NAME = "tables"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/AllTable.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**SQL Server 表属性 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class AllTable { 15 | public static final String TAG = "AllTable"; 16 | public static final String TABLE_NAME = "ALL_TABLES"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/VerifierCreator.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm; 7 | 8 | import apijson.NotNull; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /**验证器相关创建器 14 | * @author Lemon 15 | */ 16 | public interface VerifierCreator, L extends List> { 17 | 18 | @NotNull 19 | Verifier createVerifier(); 20 | } 21 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/SysColumn.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**SQL Server 在 sys 下的字段(列名) 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class SysColumn { 15 | public static final String TAG = "SysColumn"; 16 | public static final String TABLE_NAME = "columns"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/AllColumn.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**SQL Server 在 sys 下的字段(列名) 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class AllColumn { 15 | public static final String TAG = "AllColumn"; 16 | public static final String TABLE_NAME = "ALL_TAB_COLUMNS"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/AllTableComment.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**SQL Server 表属性 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class AllTableComment { 15 | public static final String TAG = "AllTableComment"; 16 | public static final String TABLE_NAME = "ALL_TAB_COMMENTS"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/ExtendedProperty.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**扩展属性,SQL Server 转用 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class ExtendedProperty { 15 | public static final String TAG = "ExtendedProperty"; 16 | public static final String TABLE_NAME = "extended_properties"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/model/AllColumnComment.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.model; 7 | 8 | import apijson.MethodAccess; 9 | 10 | /**SQL Server 在 sys 下的字段(列名) 11 | * @author Lemon 12 | */ 13 | @MethodAccess(POST = {}, PUT = {}, DELETE = {}) 14 | public class AllColumnComment { 15 | public static final String TAG = "AllColumnComment"; 16 | public static final String TABLE_NAME = "ALL_COL_COMMENTS"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .gradle 3 | yarn.lock 4 | *.project 5 | 6 | HELP.md 7 | target/ 8 | !.mvn/wrapper/maven-wrapper.jar 9 | !**/src/main/** 10 | !**/src/test/** 11 | 12 | ### STS ### 13 | .apt_generated 14 | .classpath 15 | .factorypath 16 | .project 17 | .settings 18 | .springBeans 19 | .sts4-cache 20 | 21 | ### IntelliJ IDEA ### 22 | .idea 23 | *.iws 24 | *.iml 25 | *.ipr 26 | 27 | ### NetBeans ### 28 | /nbproject/private/ 29 | /nbbuild/ 30 | /dist/ 31 | /nbdist/ 32 | /.nb-gradle/ 33 | build/ 34 | 35 | ### VS Code ### 36 | .vscode/ 37 | APIJSONORM/bin 38 | *.DS_Store 39 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/SQLCreator.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm; 7 | 8 | import apijson.NotNull; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /**SQL相关创建器 14 | * @author Lemon 15 | */ 16 | public interface SQLCreator, L extends List> { 17 | 18 | @NotNull 19 | SQLConfig createSQLConfig(); 20 | 21 | @NotNull 22 | SQLExecutor createSQLExecutor(); 23 | } 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature Request/期望新增功能 2 | description: Request a new feature/期望新增什么样的功能或特性,或者做哪些方面的改进? 3 | title: "[Feature] " 4 | labels: [kind/feature] 5 | body: 6 | - type: textarea 7 | attributes: 8 | label: Description 9 | description: | 10 | Please describe what this feature does./具体描述下是什么样的功能或特性,以及你为什么想要它,用在什么场景,碰到了什么痛点,有什么解决思路,尝试过哪些,效果怎样? 11 | 12 | validations: 13 | required: true 14 | 15 | - type: markdown 16 | attributes: 17 | value: 推荐去建议收集箱提问,也方便 统一检索和管理、投票决定优先级、更新处理进度 等: https://github.com/Tencent/APIJSON/issues/37 18 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/ParserCreator.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm; 7 | 8 | import apijson.NotNull; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /**SQL相关创建器 14 | * @author Lemon 15 | */ 16 | public interface ParserCreator, L extends List> { 17 | 18 | @NotNull 19 | Parser createParser(); 20 | 21 | @NotNull 22 | FunctionParser createFunctionParser(); 23 | } 24 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/script/ScriptExecutor.java: -------------------------------------------------------------------------------- 1 | package apijson.orm.script; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import apijson.orm.AbstractFunctionParser; 7 | 8 | public interface ScriptExecutor, L extends List> { 9 | 10 | ScriptExecutor init(); 11 | 12 | void load(String name, String script); 13 | 14 | Object execute(AbstractFunctionParser parser, Map currentObject, String methodName, Object[] args) throws Exception; 15 | 16 | void cleanCache(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/exception/ConflictException.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.exception; 7 | 8 | /**冲突 9 | * @author Lemon 10 | */ 11 | public class ConflictException extends Exception { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public ConflictException(String msg) { 15 | super(msg); 16 | } 17 | public ConflictException(Throwable t) { 18 | super(t); 19 | } 20 | public ConflictException(String msg, Throwable t) { 21 | super(msg, t); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/exception/OutOfRangeException.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.exception; 7 | 8 | /**超出范围 9 | * @author Lemon 10 | */ 11 | public class OutOfRangeException extends Exception { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public OutOfRangeException(String msg) { 15 | super(msg); 16 | } 17 | public OutOfRangeException(Throwable t) { 18 | super(t); 19 | } 20 | public OutOfRangeException(String msg, Throwable t) { 21 | super(msg, t); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/exception/NotExistException.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.exception; 7 | 8 | /**不存在,可接受,内部吃掉 9 | * @author Lemon 10 | */ 11 | public class NotExistException extends Exception { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public NotExistException(String msg) { 15 | super(msg); 16 | } 17 | public NotExistException(Throwable t) { 18 | super(t); 19 | } 20 | public NotExistException(String msg, Throwable t) { 21 | super(msg, t); 22 | } 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/exception/NotLoggedInException.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.exception; 7 | 8 | /**未登录 9 | * @author Lemon 10 | */ 11 | public class NotLoggedInException extends Exception { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public NotLoggedInException(String msg, Throwable t) { 15 | super(msg, t); 16 | } 17 | public NotLoggedInException(String msg) { 18 | super(msg); 19 | } 20 | public NotLoggedInException(Throwable t) { 21 | super(t); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/exception/ConditionErrorException.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.exception; 7 | 8 | /**条件错误 9 | * @author Lemon 10 | */ 11 | public class ConditionErrorException extends Exception { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public ConditionErrorException(String msg) { 15 | super(msg); 16 | } 17 | public ConditionErrorException(Throwable t) { 18 | super(t); 19 | } 20 | public ConditionErrorException(String msg, Throwable t) { 21 | super(msg, t); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/exception/UnsupportedDataTypeException.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm.exception; 7 | 8 | import java.io.IOException; 9 | 10 | /** 11 | * 给定的数据类型不被支持 12 | * 13 | * @author cnscoo 14 | */ 15 | 16 | public class UnsupportedDataTypeException extends IOException { 17 | private static final long serialVersionUID = 1L; 18 | 19 | public UnsupportedDataTypeException() { 20 | super(); 21 | } 22 | 23 | public UnsupportedDataTypeException(String s) { 24 | super(s); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other_issues.yml: -------------------------------------------------------------------------------- 1 | name: Other Issues/其它反馈 2 | description: For questions, suggestions, improvements and others./问题(非 bug)、建议(非新增功能) 或 其它 3 | title: "[xxx] " 4 | body: 5 | - type: textarea 6 | attributes: 7 | label: Description 8 | description: | 9 | Please describe the issue./请具体描述,包括是什么、为什么、如何做 10 | 11 | validations: 12 | required: true 13 | 14 | - type: markdown 15 | attributes: 16 | value: "Bug 反馈请使用正确的模板,用错模板将直接关闭 issue,不予解答:\n https://github.com/Tencent/APIJSON/issues/new?assignees=&labels=kind%2Fbug&template=bug_report.yml&title=%5BBug%5D+ \n有建议请去建议收集箱提问,也方便 统一检索和管理、投票决定优先级、更新处理进度 等:\n https://github.com/Tencent/APIJSON/issues/37 " 17 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/script/JavaScriptExecutor.java: -------------------------------------------------------------------------------- 1 | package apijson.orm.script; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import apijson.orm.AbstractFunctionParser; 7 | 8 | /** 9 | * JavaScript脚本语言的执行器实现 10 | */ 11 | public class JavaScriptExecutor, L extends List> extends JSR223ScriptExecutor { 12 | 13 | @Override 14 | protected String scriptEngineName() { 15 | return "javascript"; 16 | } 17 | 18 | @Override 19 | protected Object extendParameter(AbstractFunctionParser parser, Map currentObject, String methodName, Object[] args) { 20 | return null; 21 | } 22 | 23 | @Override 24 | protected boolean isLockScript(String methodName) { 25 | return false; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/JSONParser.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /**JSON 相关解析器 12 | * @author Lemon 13 | */ 14 | public interface JSONParser, L extends List> extends JSONCreator { 15 | 16 | Object parse(Object json); 17 | 18 | M parseObject(Object json); 19 | 20 | T parseObject(Object json, Class clazz); 21 | 22 | L parseArray(Object json); 23 | 24 | List parseArray(Object json, Class clazz); 25 | 26 | default String format(Object obj) { 27 | return toJSONString(obj, true); 28 | } 29 | default String toJSONString(Object obj) { 30 | return toJSONString(obj, false); 31 | } 32 | String toJSONString(Object obj, boolean format); 33 | } 34 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/NotNull.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson; 7 | 8 | import java.lang.annotation.Documented; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.Target; 11 | 12 | import static java.lang.annotation.ElementType.ANNOTATION_TYPE; 13 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 14 | import static java.lang.annotation.ElementType.FIELD; 15 | import static java.lang.annotation.ElementType.METHOD; 16 | import static java.lang.annotation.ElementType.PARAMETER; 17 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 18 | 19 | 20 | /**非null注解 21 | * javax.validation.constraints.NotNull不在JDK里面,为了减少第三方库引用就在这里实现了一个替代品 22 | * @author Lemon 23 | */ 24 | @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER }) 25 | @Retention(RUNTIME) 26 | @Documented 27 | public @interface NotNull { 28 | } 29 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/Entry.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm; 7 | 8 | import java.util.Map; 9 | 10 | /**自定义Entry 11 | * *java.util.Map.Entry是interface,new Entry(...)不好用,其它的Entry也不好用 12 | * @author Lemon 13 | * @param key 14 | * @param value 15 | * @use new Entry(...) 16 | * @warn K,V都需要基本类型时不建议使用,判空麻烦,不如新建一个Model 17 | */ 18 | public class Entry implements Map.Entry { 19 | 20 | public K key; 21 | public V value; 22 | 23 | public Entry() { 24 | //default 25 | } 26 | public Entry(K key) { 27 | this(key, null); 28 | } 29 | public Entry(K key, V value) { 30 | this.key = key; 31 | this.value = value; 32 | } 33 | 34 | 35 | public K getKey() { 36 | return key; 37 | } 38 | public void setKey(K key) { 39 | this.key = key; 40 | } 41 | public V getValue() { 42 | return value; 43 | } 44 | public V setValue(V value) { 45 | this.value = value; 46 | return value; 47 | } 48 | 49 | public boolean isEmpty() { 50 | return key == null && value == null; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/OnParseCallback.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * @author Lemon 13 | */ 14 | public abstract class OnParseCallback, L extends List> { 15 | 16 | 17 | /** 18 | * @param key 19 | * @param to 20 | * @param ro 21 | * @return false ? continue 22 | * @throws Exception 23 | */ 24 | protected boolean onParse(String key, Object to, Object ro) throws Exception { 25 | return true; 26 | } 27 | 28 | /** 29 | * @param key 30 | * @param to 31 | * @param ro 32 | * @return 33 | * @throws Exception 34 | */ 35 | protected Object onParseObject(String key, Object to, Object ro) throws Exception { 36 | return ro; 37 | } 38 | 39 | /** 40 | * @param key 41 | * @param tobj 42 | * @param robj 43 | * @return 44 | * @throws Exception 45 | */ 46 | protected M onParseJSONObject(String key, M tobj, M robj) throws Exception { 47 | return robj; 48 | } 49 | 50 | /** 51 | * @param key 52 | * @param tarray 53 | * @param rarray 54 | * @return 55 | * @throws Exception 56 | */ 57 | protected L onParseJSONArray(String key, L tarray, L rarray) throws Exception { 58 | return rarray; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/JSONCreator.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson; 7 | 8 | import java.util.Collection; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /**JSON相关创建器 13 | * @author Lemon 14 | */ 15 | public interface JSONCreator, L extends List> { 16 | 17 | @NotNull 18 | M createJSONObject(); 19 | 20 | @NotNull 21 | default M createJSONObject(String key, Object value) { 22 | M obj = createJSONObject(); 23 | obj.put(key, value); 24 | return obj; 25 | } 26 | 27 | @NotNull 28 | default M createJSONObject(Map map) { 29 | M obj = createJSONObject(); 30 | if (map != null && ! map.isEmpty()) { 31 | obj.putAll(map); 32 | } 33 | return obj; 34 | } 35 | 36 | @NotNull 37 | L createJSONArray(); 38 | 39 | @NotNull 40 | default L createJSONArray(Object obj){ 41 | L arr = createJSONArray(); 42 | arr.add(obj); 43 | return arr; 44 | } 45 | 46 | @NotNull 47 | default L createJSONArray(Collection list){ 48 | L arr = createJSONArray(); 49 | if (list != null && ! list.isEmpty()) { 50 | arr.addAll(list); 51 | } 52 | return arr; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/FunctionParser.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | import apijson.*; 12 | 13 | 14 | /**远程函数解析器 15 | * @author Lemon 16 | */ 17 | public interface FunctionParser, L extends List> { 18 | 19 | Object invoke(@NotNull String function, @NotNull M currentObject) throws Exception; 20 | Object invoke(@NotNull String function, @NotNull M currentObject, boolean containRaw) throws Exception; 21 | 22 | Parser getParser(); 23 | 24 | FunctionParser setParser(Parser parser); 25 | 26 | RequestMethod getMethod(); 27 | FunctionParser setMethod(RequestMethod method); 28 | 29 | String getTag(); 30 | FunctionParser setTag(String tag); 31 | 32 | int getVersion(); 33 | FunctionParser setVersion(int version); 34 | 35 | @NotNull 36 | M getRequest(); 37 | FunctionParser setRequest(@NotNull M request); 38 | 39 | 40 | String getKey(); 41 | FunctionParser setKey(String key); 42 | 43 | String getParentPath(); 44 | FunctionParser setParentPath(String parentPath); 45 | 46 | String getCurrentName(); 47 | FunctionParser setCurrentName(String currentName); 48 | 49 | 50 | @NotNull 51 | M getCurrentObject(); 52 | FunctionParser setCurrentObject(@NotNull M currentObject); 53 | 54 | } 55 | -------------------------------------------------------------------------------- /APIJSONORM/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.github.Tencent 7 | APIJSON 8 | 8.1.0 9 | jar 10 | 11 | APIJSONORM 12 | APIJSON ORM Library 13 | 14 | 15 | UTF-8 16 | UTF-8 17 | 1.8 18 | UTF-8 19 | 1.8 20 | 1.8 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | org.apache.maven.plugins 30 | maven-compiler-plugin 31 | 3.12.1 32 | 33 | 1.8 34 | 1.8 35 | 36 | 37 | 38 | 39 | org.apache.maven.plugins 40 | maven-source-plugin 41 | 3.2.1 42 | 43 | 44 | package 45 | 46 | jar-no-fork 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /APIJSONORM/src/main/java/apijson/orm/Subquery.java: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2020 Tencent. All rights reserved. 2 | 3 | This source code is licensed under the Apache License Version 2.0.*/ 4 | 5 | 6 | package apijson.orm; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /**子查询 配置 12 | * @author Lemon 13 | */ 14 | public class Subquery, L extends List> { 15 | 16 | private String path; // []/0/User 17 | private String originKey; //id{}@ 18 | private M originValue; // { "from": "Comment", "Comment": {...} } 19 | 20 | private String from; // Comment 21 | private String range; // ANY, ALL 22 | private String key; //id{} 23 | private SQLConfig config; 24 | 25 | public String gainPath() { 26 | return path; 27 | } 28 | public void setPath(String path) { 29 | this.path = path; 30 | } 31 | 32 | public String gainOriginKey() { 33 | return originKey; 34 | } 35 | public void setOriginKey(String originKey) { 36 | this.originKey = originKey; 37 | } 38 | 39 | public M gainOriginValue() { 40 | return originValue; 41 | } 42 | public void setOriginValue(M originValue) { 43 | this.originValue = originValue; 44 | } 45 | 46 | public String gainFrom() { 47 | return from; 48 | } 49 | public void setFrom(String from) { 50 | this.from = from; 51 | } 52 | 53 | public String gainRange() { 54 | return range; 55 | } 56 | public void setRange(String range) { 57 | this.range = range; 58 | } 59 | 60 | public String gainKey() { 61 | return key; 62 | } 63 | public void setKey(String key) { 64 | this.key = key; 65 | } 66 | 67 | public SQLConfig gainConfig() { 68 | return config; 69 | } 70 | public void setConfig(SQLConfig config) { 71 | this.config = config; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /APIJSONORM/README.md: -------------------------------------------------------------------------------- 1 | # APIJSONORM [![](https://jitpack.io/v/Tencent/APIJSON.svg)](https://jitpack.io/#Tencent/APIJSON) [Ask DeepWiki.com](https://deepwiki.com/Tencent/APIJSON) 2 | 腾讯 [APIJSON](https://github.com/Tencent/APIJSON) ORM 库,可通过 Maven, Gradle 等远程依赖。
3 | Tencent [APIJSON](https://github.com/Tencent/APIJSON) ORM library for remote dependencies with Maven, Gradle, etc. 4 | 5 | ### Maven 6 | #### 1. 在 pom.xml 中添加 JitPack 仓库 7 | #### 1. Add the JitPack repository to pom.xml 8 | ```xml 9 | 10 | 11 | jitpack.io 12 | https://jitpack.io 13 | 14 | 15 | ``` 16 |
17 | 18 | #### 2. 在 pom.xml 中添加 APIJSON 依赖 19 | #### 2. Add the APIJSON dependency to pom.xml 20 | ```xml 21 | 22 | com.github.Tencent 23 | APIJSON 24 | LATEST 25 | 26 | ``` 27 | 28 |
29 |
30 | 31 | ### Gradle 32 | #### 1. 在项目根目录 build.gradle 中最后添加 JitPack 仓库 33 | #### 1. Add the JitPack repository in your root build.gradle at the end of repositories 34 | ```gradle 35 | allprojects { 36 | repositories { 37 | ... 38 | maven { url 'https://jitpack.io' } 39 | } 40 | } 41 | ``` 42 |
43 | 44 | #### 2. 在项目某个 module 目录(例如 `app`) build.gradle 中添加 apijson-orm 依赖 45 | #### 2. Add the APIJSON dependency in one of your modules(such as `app`) 46 | ```gradle 47 | dependencies { 48 | implementation 'com.github.Tencent:APIJSON:latest' 49 | } 50 | ``` 51 | 52 |
53 |
54 | 55 | ### FASTJSON 2 56 | #### Code 57 | https://github.com/Tencent/APIJSON/tree/fastjson2 58 | 59 | #### Maven 60 | https://mvnrepository.com/artifact/com.github.linushp/zikai-apijson/1.0 61 | 62 |
63 | 64 | ### Unit Test 65 | http://apijson.cn/unit 66 | -------------------------------------------------------------------------------- /CONTRIBUTING_COMMIT.md: -------------------------------------------------------------------------------- 1 | # Commit 规范 2 | 3 | 在对项目作出更改后,我们需要生成 Commit 来记录自己的更改。以下是参照 Angular 对 Commit 格式的规范: 4 | 5 | ## (1) 格式 6 | 7 | 提交信息包括三个部分:`Header`,`Body` 和 `Footer`。 8 | 9 | ``` 10 |
11 | 12 | 13 | 14 |