diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml
new file mode 100644
index 0000000..b49a3d6
--- /dev/null
+++ b/.github/workflows/javadoc.yml
@@ -0,0 +1,73 @@
+# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
+
+name: Javadoc
+
+on:
+ # 支持手动触发构建
+ workflow_dispatch:
+ release:
+ # 创建release的时候触发
+ types: [ published ]
+
+jobs:
+ api-website:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout the repo
+ uses: actions/checkout@v2
+
+ - name: Set up the Java JDK
+ uses: actions/setup-java@v2
+ with:
+ java-version: '11'
+ distribution: 'adopt'
+
+ - name: Generate docs
+ run: mvn javadoc:javadoc
+
+ - name: Copy to Location
+ run: |
+ rm -rf docs
+ mkdir -vp docs
+ cp -vrf easysql-api/target/site/apidocs/* docs/
+ cp -vrf JAVADOC-README.md docs/README.md
+
+ - name: Generate the sitemap
+ id: sitemap
+ uses: cicirello/generate-sitemap@v1
+ with:
+ base-url-path: https://carmjos.github.io/userprefix
+ path-to-root: docs
+
+ - name: Output stats
+ run: |
+ echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
+ echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
+ echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
+
+ - name: Configure Git
+ env:
+ DEPLOY_PRI: ${{secrets.DEPLOY_PRI}}
+ run: |
+ sudo timedatectl set-timezone "Asia/Shanghai"
+ mkdir -p ~/.ssh/
+ echo "$DEPLOY_PRI" > ~/.ssh/id_rsa
+ chmod 600 ~/.ssh/id_rsa
+ ssh-keyscan github.com >> ~/.ssh/known_hosts
+ git config --global user.name 'CarmJos'
+ git config --global user.email 'carm@carm.cc'
+
+ - name: Commit documentation changes
+ run: |
+ cd docs
+ git init
+ git remote add origin git@github.com:CarmJos/UserPrefix.git
+ git checkout -b gh-pages
+ git add -A
+ git commit -m "API Document generated."
+ - name: Push javadocs
+ run: |
+ cd docs
+ git push origin HEAD:gh-pages --force
+
diff --git a/easysql-api/pom.xml b/easysql-api/pom.xml
index 5f97a6c..ec0dc72 100644
--- a/easysql-api/pom.xml
+++ b/easysql-api/pom.xml
@@ -5,14 +5,14 @@
cc.carm.lib
easysql-parent
- 1.0.0
+ v0.0.1
4.0.0
easysql-api
jar
- EasySQL-API
+ 00-EasySQL-API
EasySQL的接口部分。用于打包到公共项目的API中,避免项目过大。
https://github.com/CarmJos/${project.parent.name}
@@ -57,10 +57,6 @@
org.apache.maven.plugins
maven-shade-plugin
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
diff --git a/easysql-api/src/main/java/cc/carm/lib/easysql/api/SQLAction.java b/easysql-api/src/main/java/cc/carm/lib/easysql/api/SQLAction.java
new file mode 100644
index 0000000..f7965a8
--- /dev/null
+++ b/easysql-api/src/main/java/cc/carm/lib/easysql/api/SQLAction.java
@@ -0,0 +1,60 @@
+package cc.carm.lib.easysql.api;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.sql.SQLException;
+import java.util.UUID;
+import java.util.function.Consumer;
+
+public interface SQLAction {
+
+ @NotNull UUID getActionUUID();
+
+ @NotNull String getShortID();
+
+ long getCreateTime();
+
+ @NotNull String getSQLContent();
+
+ @NotNull SQLManager getManager();
+
+ @NotNull T execute() throws SQLException;
+
+ @Nullable
+ default T execute(@Nullable Consumer exceptionHandler) {
+ if (exceptionHandler == null) exceptionHandler = defaultExceptionHandler();
+ T value = null;
+ try {
+ value = execute();
+ } catch (SQLException exception) {
+ exceptionHandler.accept(exception);
+ }
+ return value;
+ }
+
+ default void executeAsync() {
+ executeAsync(null);
+ }
+
+ default void executeAsync(Consumer success) {
+ executeAsync(success, null);
+ }
+
+ void executeAsync(Consumer success, Consumer failure);
+
+ SQLAction handleException(Consumer failure);
+
+ @NotNull Consumer getExceptionHandler();
+
+ default Consumer defaultExceptionHandler() {
+ return Throwable::printStackTrace;
+ }
+
+ default Consumer defaultResultHandler() {
+ return t -> {
+ };
+ }
+
+
+}
diff --git a/easysql-api/src/main/java/cc/carm/lib/easysql/api/SQLBuilder.java b/easysql-api/src/main/java/cc/carm/lib/easysql/api/SQLBuilder.java
new file mode 100644
index 0000000..90690e8
--- /dev/null
+++ b/easysql-api/src/main/java/cc/carm/lib/easysql/api/SQLBuilder.java
@@ -0,0 +1,9 @@
+package cc.carm.lib.easysql.api;
+
+import org.jetbrains.annotations.NotNull;
+
+public interface SQLBuilder {
+
+ @NotNull SQLManager getManager();
+
+}
diff --git a/easysql-api/src/main/java/cc/carm/lib/easysql/api/SQLManager.java b/easysql-api/src/main/java/cc/carm/lib/easysql/api/SQLManager.java
index b9b71c8..0d14b84 100644
--- a/easysql-api/src/main/java/cc/carm/lib/easysql/api/SQLManager.java
+++ b/easysql-api/src/main/java/cc/carm/lib/easysql/api/SQLManager.java
@@ -1,7 +1,94 @@
package cc.carm.lib.easysql.api;
+import cc.carm.lib.easysql.api.action.PreparedSQLUpdateAction;
+import cc.carm.lib.easysql.api.action.PreparedSQLUpdateBatchAction;
+import cc.carm.lib.easysql.api.builder.*;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
public interface SQLManager {
+ boolean isDebugMode();
+ void setDebugMode(boolean enable);
+
+ /**
+ * 得到连接池源
+ *
+ * @return DataSource
+ */
+ @NotNull DataSource getDataSource();
+
+ /**
+ * 得到一个数据库连接实例
+ *
+ * @return Connection
+ */
+ @NotNull Connection getConnection() throws SQLException;
+
+ /**
+ * 得到正使用的查询。
+ *
+ * @return 查询列表
+ */
+ @NotNull Map getActiveQuery();
+
+ /**
+ * 执行一条不需要返回结果的SQL语句(多用于UPDATE、REPLACE、DELETE方法)
+ *
+ * @param sql SQL语句内容
+ * @return 更新的行数
+ */
+ @Nullable Integer executeSQL(String sql);
+
+ /**
+ * 执行一条不需要返回结果的SQL更改(UPDATE、REPLACE、DELETE)
+ *
+ * @param sql SQL语句内容
+ * @return 更新的行数
+ */
+ @Nullable Integer executeSQL(String sql, Object[] params);
+
+ /**
+ * 执行多条不需要返回结果的SQL更改(UPDATE、REPLACE、DELETE)
+ *
+ * @param sql SQL语句内容
+ * @return 对应参数返回的行数
+ */
+ @Nullable List executeSQLBatch(String sql, Iterable