feat(data/core): 新增获取数据库类型带默认类型方法

This commit is contained in:
2024-02-19 21:40:48 +08:00
parent 56a22c4bce
commit 31ca1fda52

View File

@@ -44,6 +44,19 @@ public class MetaUtils {
private MetaUtils() {
}
/**
* 获取数据库类型(如果获取不到数据库类型,则返回默认数据库类型)
*
* @param dataSource 数据源
* @param defaultValue 默认数据库类型
* @return 数据库类型
* @since 1.4.1
*/
public static DatabaseType getDatabaseTypeOrDefault(DataSource dataSource, DatabaseType defaultValue) {
DatabaseType databaseType = getDatabaseType(dataSource);
return null == databaseType ? defaultValue : databaseType;
}
/**
* 获取数据库类型
*