Skip to content

Commit b543bc2

Browse files
authored
Dev 2025.1.1 (#941)
2 parents 2dea840 + b4d99d5 commit b543bc2

File tree

2 files changed

+42
-25
lines changed

2 files changed

+42
-25
lines changed

plugin/datacap-plugin-doris/src/main/kotlin/io/edurt/datacap/plugin/DorisService.kt

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package io.edurt.datacap.plugin
22

3+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
34
import io.edurt.datacap.spi.PluginService
45
import io.edurt.datacap.spi.generator.definition.TableDefinition
56
import io.edurt.datacap.spi.model.Configure
67
import io.edurt.datacap.spi.model.Response
78

9+
@SuppressFBWarnings(value = ["NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"])
810
class DorisService : PluginService
911
{
1012
override fun connectType(): String
@@ -17,11 +19,13 @@ class DorisService : PluginService
1719
return "com.mysql.cj.jdbc.Driver"
1820
}
1921

20-
override fun isSupportMeta(): Boolean {
22+
override fun isSupportMeta(): Boolean
23+
{
2124
return true
2225
}
2326

24-
override fun getTables(configure: Configure?, database: String?): Response {
27+
override fun getTables(configure: Configure?, database: String?): Response
28+
{
2529
val sql = """SELECT
2630
CASE
2731
WHEN type = 'BASE TABLE' THEN 'table'
@@ -84,10 +88,11 @@ class DorisService : PluginService
8488
END,
8589
object_name;"""
8690

87-
return this.execute(configure, sql.replace("{0}", database!!))
91+
return this.execute(configure, sql.replace("{0}", database !!))
8892
}
8993

90-
override fun getColumns(configure: Configure?, database: String?, table: String?): Response {
94+
override fun getColumns(configure: Configure?, database: String?, table: String?): Response
95+
{
9196
val sql = """SELECT detail.*
9297
FROM (
9398
-- 列信息
@@ -186,12 +191,13 @@ class DorisService : PluginService
186191

187192
return this.execute(
188193
configure,
189-
sql.replace("{0}", database!!)
190-
.replace("{1}", table!!)
194+
sql.replace("{0}", database !!)
195+
.replace("{1}", table !!)
191196
)
192197
}
193198

194-
override fun getSuggests(configure: Configure?, keyword: String?): Response {
199+
override fun getSuggests(configure: Configure?, keyword: String?): Response
200+
{
195201
val sql = """SELECT * FROM (
196202
-- 数据库
197203
SELECT
@@ -289,14 +295,15 @@ class DorisService : PluginService
289295
ORDER BY sort_order, object_name limit 10;"""
290296
return this.execute(
291297
configure,
292-
sql.replace("{0}", keyword!!)
298+
sql.replace("{0}", keyword !!)
293299
)
294300
}
295301

296-
override fun getColumn(configure: Configure?, definition: TableDefinition?): Response {
297-
val column = definition!!.columns.stream().findAny()
302+
override fun getColumn(configure: Configure?, definition: TableDefinition?): Response
303+
{
304+
val column = definition !!.columns.stream().findAny()
298305

299-
require(!column.isEmpty) { "Column must be specified" }
306+
require(! column.isEmpty) { "Column must be specified" }
300307

301308
val sql = """SELECT
302309
detail.*

plugin/datacap-plugin-starrocks/src/main/kotlin/io/edurt/datacap/plugin/StarRocksService.kt

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
package io.edurt.datacap.plugin
22

3+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
34
import io.edurt.datacap.spi.PluginService
45
import io.edurt.datacap.spi.generator.definition.TableDefinition
56
import io.edurt.datacap.spi.model.Configure
67
import io.edurt.datacap.spi.model.Response
78

8-
class StarRocksService : PluginService {
9-
override fun connectType(): String {
9+
@SuppressFBWarnings(value = ["NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"])
10+
class StarRocksService : PluginService
11+
{
12+
override fun connectType(): String
13+
{
1014
return "mysql"
1115
}
1216

13-
override fun driver(): String {
17+
override fun driver(): String
18+
{
1419
return "com.mysql.cj.jdbc.Driver"
1520
}
1621

17-
override fun isSupportMeta(): Boolean {
22+
override fun isSupportMeta(): Boolean
23+
{
1824
return true
1925
}
2026

21-
override fun getTables(configure: Configure?, database: String?): Response {
27+
override fun getTables(configure: Configure?, database: String?): Response
28+
{
2229
val sql = """SELECT
2330
CASE
2431
WHEN type = 'BASE TABLE' THEN 'table'
@@ -81,10 +88,11 @@ class StarRocksService : PluginService {
8188
END,
8289
object_name;"""
8390

84-
return this.execute(configure, sql.replace("{0}", database!!))
91+
return this.execute(configure, sql.replace("{0}", database !!))
8592
}
8693

87-
override fun getColumns(configure: Configure?, database: String?, table: String?): Response {
94+
override fun getColumns(configure: Configure?, database: String?, table: String?): Response
95+
{
8896
val sql = """SELECT detail.*
8997
FROM (
9098
-- 列信息
@@ -183,12 +191,13 @@ class StarRocksService : PluginService {
183191

184192
return this.execute(
185193
configure,
186-
sql.replace("{0}", database!!)
187-
.replace("{1}", table!!)
194+
sql.replace("{0}", database !!)
195+
.replace("{1}", table !!)
188196
)
189197
}
190198

191-
override fun getSuggests(configure: Configure?, keyword: String?): Response {
199+
override fun getSuggests(configure: Configure?, keyword: String?): Response
200+
{
192201
val sql = """SELECT * FROM (
193202
-- 数据库
194203
SELECT
@@ -286,14 +295,15 @@ class StarRocksService : PluginService {
286295
ORDER BY sort_order, object_name limit 10;"""
287296
return this.execute(
288297
configure,
289-
sql.replace("{0}", keyword!!)
298+
sql.replace("{0}", keyword !!)
290299
)
291300
}
292301

293-
override fun getColumn(configure: Configure?, definition: TableDefinition?): Response {
294-
val column = definition!!.columns.stream().findAny()
302+
override fun getColumn(configure: Configure?, definition: TableDefinition?): Response
303+
{
304+
val column = definition !!.columns.stream().findAny()
295305

296-
require(!column.isEmpty) { "Column must be specified" }
306+
require(! column.isEmpty) { "Column must be specified" }
297307

298308
val sql = """SELECT
299309
detail.*

0 commit comments

Comments
 (0)