Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.firefly.db;
import com.firefly.utils.function.Func1;
import java.sql.Connection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
/**
* The asynchronous SQL connection. It can execute SQL and bind result to Java bean.
*
* @author Pengtao Qiu
*/
public interface SQLConnection {
/**
* Query single column record by SQL. If the database has not record, it will emit the RecordNotFound exception.
*
* @param sql A SQL that may contain one or more '?' placeholders.
* @param params SQL parameters.
* @param The type of column.
* @return The future result.
*/
CompletableFuture queryForSingleColumn(String sql, Object... params);
/**
* Query single column record by named SQL. If the database has not record, it will emit the RecordNotFound exception.
*
* @param sql A SQL that may contain one or more placeholders. The placeholder starts with ":" or "&", such as,
* "select * from test where id in (:idList)",
* "select * from test where id = :id",
* "select * from test where id = :{id}",
* "select * from test where id = &id".
* @param paramMap Named SQL parameters.
* @param The type of column.
* @return The future result.
*/
CompletableFuture namedQueryForSingleColumn(String sql, Map paramMap);
/**
* Query single column record by named SQL. If the database has not record, it will emit the RecordNotFound exception.
*
* @param sql A SQL that may contain one or more placeholders. The placeholder starts with ":" or "&", such as,
* "select * from test where id in (:idList)",
* "select * from test where id = :id",
* "select * from test where id = :{id}",
* "select * from test where id = &id".
* @param paramObject Named SQL parameter object that uses the property name to match parameter.
* @param The type of column.
* @return The future result.
*/
CompletableFuture namedQueryForSingleColumn(String sql, Object paramObject);
/**
* Query record and bind object. If the database has not record, it will emit the RecordNotFound exception.
*
* @param sql A SQL that may contain one or more '?' placeholders.
* @param clazz The Class reference of bound object.
* @param params SQL parameters.
* @param The type of bound object.
* @return The future result.
*/
CompletableFuture queryForObject(String sql, Class clazz, Object... params);
/**
* Query record and bind object. If the database has not record, it will emit the RecordNotFound exception.
*
* @param sql A SQL that may contain one or more placeholders. The placeholder starts with ":" or "&", such as,
* "select * from test where id in (:idList)",
* "select * from test where id = :id",
* "select * from test where id = :{id}",
* "select * from test where id = &id".
* @param clazz The Class reference of bound object.
* @param paramMap Named SQL parameters.
* @param The type of bound object.
* @return The future result.
*/
CompletableFuture namedQueryForObject(String sql, Class clazz, Map paramMap);
/**
* Query record and bind object. If the database has not record, it will emit the RecordNotFound exception.
*
* @param sql A SQL that may contain one or more placeholders. The placeholder starts with ":" or "&", such as,
* "select * from test where id in (:idList)",
* "select * from test where id = :id",
* "select * from test where id = :{id}",
* "select * from test where id = &id".
* @param clazz The Class reference of bound object.
* @param paramObject Named SQL parameter object that uses the property name to match parameter.
* @param The type of bound object.
* @return The future result.
*/
CompletableFuture namedQueryForObject(String sql, Class clazz, Object paramObject);
/**
* Query record by id. If the database has not record, it will emit the RecordNotFound exception.
*
* @param id Primary key.
* @param clazz The Class reference of bound object.
* @param The type of bound object.
* @return The future result.
*/
CompletableFuture queryById(Object id, Class clazz);
/**
* Query records and convert records to a Map.
*
* @param sql A SQL that may contain one or more '?' placeholders.
* @param valueClass The Class reference of bound object.
* @param params SQL parameters.
* @param The type of primary key.
* @param The type of bound object.
* @return The future result that contains a map, the key is primary key of record, the value is bound object.
*/
CompletableFuture