Skip to content

Commit 8d28187

Browse files
committed
feat: support TursoDB - SQLite-based Rust database for LLM AI Agents(edge computing), users, or tenants; upgrade APIJSON&self 8.4.0, apijson-framework 8.4.1, fastjson2 2.0.66
1 parent f854581 commit 8d28187

8 files changed

Lines changed: 29 additions & 5 deletions

File tree

Binary file not shown.
Binary file not shown.
Binary file not shown.

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/libs/apijson-fastjson2-1.2.1.jar renamed to APIJSON-Java-Server/APIJSONBoot-MultiDataSource/libs/apijson-fastjson2-1.4.0.jar

37 KB
Binary file not shown.

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/libs/apijson-framework-8.2.0.jar renamed to APIJSON-Java-Server/APIJSONBoot-MultiDataSource/libs/apijson-framework-8.4.1.jar

104 KB
Binary file not shown.

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/pom.xml‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>apijson.boot</groupId>
77
<artifactId>apijson-boot-multi-datasource</artifactId>
8-
<version>8.3.2</version>
8+
<version>8.4.0</version>
99
<packaging>jar</packaging>
1010

1111
<name>APIJSONBoot-MultiDataSource</name>
@@ -26,7 +26,7 @@
2626
<dependency>
2727
<groupId>com.alibaba.fastjson2</groupId>
2828
<artifactId>fastjson2</artifactId>
29-
<version>2.0.65</version>
29+
<version>2.0.66</version>
3030
</dependency>
3131

3232
<!-- apijson-framework 需要用的依赖库,5.0.0 以上 -->
@@ -59,18 +59,18 @@
5959
<dependency>
6060
<groupId>com.github.Tencent</groupId>
6161
<artifactId>APIJSON</artifactId>
62-
<version>8.3.2</version>
62+
<version>8.4.0</version>
6363
</dependency>
6464
<dependency>
6565
<groupId>com.github.APIJSON</groupId>
6666
<artifactId>apijson-framework</artifactId>
67-
<version>8.3.2</version>
67+
<version>8.4.1</version>
6868
</dependency>
6969
<!-- fastjson2, jackson, gson 等 JSON 库插件选其中一个即可 <<<<<<<<<<<<<<< -->
7070
<dependency>
7171
<groupId>com.github.APIJSON</groupId>
7272
<artifactId>apijson-fastjson2</artifactId>
73-
<version>1.3.3</version>
73+
<version>1.4.0</version>
7474
</dependency>
7575
<!-- <dependency>-->
7676
<!-- <groupId>com.github.APIJSON</groupId>-->
@@ -262,6 +262,11 @@
262262
<artifactId>mongodb-jdbc</artifactId>
263263
<version>2.0.3</version>
264264
</dependency>
265+
<dependency>
266+
<groupId>tech.turso</groupId>
267+
<artifactId>turso</artifactId>
268+
<version>0.8.3</version>
269+
</dependency>
265270

266271
<!-- <dependency>-->
267272
<!-- <groupId>org.opengauss</groupId>-->

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/java/apijson/boot/DemoApplication.java‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,16 @@ public void addCorsMappings(CorsRegistry registry) {
216216
Log.e(TAG, "加载 DuckDB 驱动失败,请检查 pom.xml 中 org.duckdb 版本是否存在以及可用 !!!");
217217
}
218218

219+
try { //加载驱动程序
220+
Log.d(TAG, "尝试加载 Turso 驱动 <<<<<<<<<<<<<<<<<<<<< ");
221+
Class.forName("tech.turso.JDBC");
222+
Log.d(TAG, "成功加载 Turso 驱动!>>>>>>>>>>>>>>>>>>>>> ");
223+
}
224+
catch (ClassNotFoundException e) {
225+
e.printStackTrace();
226+
Log.e(TAG, "加载 Turso 驱动失败,请检查 pom.xml 中 tech.turso 版本是否存在以及可用 !!!");
227+
}
228+
219229
// try { //加载驱动程序
220230
// Log.d(TAG, "尝试加载 TDengine 驱动 <<<<<<<<<<<<<<<<<<<<< ");
221231
// Class.forName("com.taosdata.jdbc.TSDBDriver");

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/java/apijson/demo/DemoSQLConfig.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,9 @@ public String gainDBUri() {
298298
// if (isSQLite()) {
299299
// return "jdbc:sqlite:sample.db"; //TODO 改成你自己的
300300
// }
301+
if (isTurso()) {
302+
return "jdbc:turso:db"; //TODO 改成你自己的
303+
}
301304
if (isDameng()) {
302305
return "jdbc:dm://localhost:5236"; //TODO 改成你自己的
303306
}
@@ -657,6 +660,12 @@ protected int getMaxCombineCount() {
657660
//// return IoTDBUtil.getSQLSchema(super.getSQLSchema().replaceAll("-", "."), isIoTDB());
658661
// }
659662

663+
@Override
664+
public String gainSQLSchema() {
665+
// Turso 的 schema 是 ATTACH 的库名,但 Java 驱动没开放 --experimental-attach,只能用 main,否则报 no such database
666+
return isTurso() ? "main" : super.gainSQLSchema();
667+
}
668+
660669
@Override
661670
public String gainSQLTable() {
662671
String t = super.gainSQLTable();

0 commit comments

Comments
 (0)