1
mirror of https://github.com/CarmJos/EasySQL.git synced 2024-09-19 21:35:47 +00:00

[v0.2.1-fix] 补全缺失的javadoc

This commit is contained in:
Carm Jos 2021-12-14 20:19:04 +08:00
parent 7621c86495
commit ebc96e5176
2 changed files with 66 additions and 10 deletions

View File

@ -13,14 +13,14 @@ import java.util.function.Function;
* SQLAction 是用于承载SQL语句并进行处理返回的基本类
*
* <ul>
* <li>同步执行 {@link #execute()}, {@link #execute(Function, BiConsumer)}</li>
* <li>同步执行 {@link #execute()}, {@link #execute(Function, BiConsumer)}
* <br>同步执行方法中有会抛出异常的方法与不抛出异常的方法
* <br>若选择不抛出异常则返回值可能为空需要特殊处理
* <br>若选择不抛出异常则返回值可能为空需要特殊处理</li>
*
* <li>异步执行 {@link #executeAsync(Consumer, BiConsumer)}</li>
* <li>异步执行 {@link #executeAsync(Consumer, BiConsumer)}
* <br>异步执行时将提供成功与异常两种处理方式
* <br>可自行选择是否对数据或异常进行处理
* <br>默认的异常处理器为 {@link #defaultExceptionHandler()}
* <br>默认的异常处理器为 {@link #defaultExceptionHandler()}</li>
* </ul>
*
* <b>注意 无论是否异步都不需要自行关闭ResultSet本API已自动关闭</b>

View File

@ -2,6 +2,8 @@ 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.action.SQLUpdateAction;
import cc.carm.lib.easysql.api.action.SQLUpdateBatchAction;
import cc.carm.lib.easysql.api.action.query.SQLQuery;
import cc.carm.lib.easysql.api.builder.*;
import org.jetbrains.annotations.NotNull;
@ -34,6 +36,7 @@ public interface SQLManager {
* 得到一个数据库连接实例
*
* @return Connection
* @throws SQLException {@link DataSource#getConnection()}
*/
@NotNull Connection getConnection() throws SQLException;
@ -49,14 +52,17 @@ public interface SQLManager {
*
* @param sql SQL语句内容
* @return 更新的行数
* @see SQLUpdateAction
*/
@Nullable Integer executeSQL(String sql);
/**
* 执行一条不需要返回结果的SQL更改(UPDATEREPLACEDELETE)
* 执行一条不需要返回结果的预处理SQL更改(UPDATEREPLACEDELETE)
*
* @param sql SQL语句内容
* @param sql SQL语句内容
* @param params SQL语句中 ? 的对应参数
* @return 更新的行数
* @see PreparedSQLUpdateAction
*/
@Nullable Integer executeSQL(String sql, Object[] params);
@ -65,6 +71,7 @@ public interface SQLManager {
*
* @param sql SQL语句内容
* @return 对应参数返回的行数
* @see PreparedSQLUpdateBatchAction
*/
@Nullable List<Integer> executeSQLBatch(String sql, Iterable<Object[]> paramsBatch);
@ -72,8 +79,10 @@ public interface SQLManager {
/**
* 执行多条不需要返回结果的SQL
*
* @param sql SQL语句内容
* @param sql SQL语句内容
* @param moreSQL 更多SQL语句内容
* @return 对应参数返回的行数
* @see SQLUpdateBatchAction
*/
@Nullable List<Integer> executeSQLBatch(@NotNull String sql, String... moreSQL);
@ -85,20 +94,67 @@ public interface SQLManager {
*/
@Nullable List<Integer> executeSQLBatch(@NotNull Iterable<String> sqlBatch);
/**
* 在库中创建一个表
*
* @param tableName 表名
* @return {@link TableCreateBuilder}
*/
TableCreateBuilder createTable(@NotNull String tableName);
/**
* 新建一个查询
*
* @return {@link QueryBuilder}
*/
QueryBuilder createQuery();
InsertBuilder<PreparedSQLUpdateBatchAction> createInsertBatch(@NotNull String tableName);
/**
* 创建一条插入操作
*
* @param tableName 目标表名
* @return {@link InsertBuilder}
*/
InsertBuilder<PreparedSQLUpdateAction> createInsert(@NotNull String tableName);
ReplaceBuilder<PreparedSQLUpdateBatchAction> createReplaceBatch(@NotNull String tableName);
/**
* 创建支持多组数据的插入操作
*
* @param tableName 目标表名
* @return {@link InsertBuilder}
*/
InsertBuilder<PreparedSQLUpdateBatchAction> createInsertBatch(@NotNull String tableName);
/**
* 创建一条替换操作
*
* @param tableName 目标表名
* @return {@link ReplaceBuilder}
*/
ReplaceBuilder<PreparedSQLUpdateAction> createReplace(@NotNull String tableName);
/**
* 创建支持多组数据的替换操作
*
* @param tableName 目标表名
* @return {@link ReplaceBuilder}
*/
ReplaceBuilder<PreparedSQLUpdateBatchAction> createReplaceBatch(@NotNull String tableName);
/**
* 创建更新操作
*
* @param tableName 目标表名
* @return {@link UpdateBuilder}
*/
UpdateBuilder createUpdate(@NotNull String tableName);
/**
* 创建删除操作
*
* @param tableName 目标表名
* @return {@link DeleteBuilder}
*/
DeleteBuilder createDelete(@NotNull String tableName);
}