Skip to content

Commit 4bef6df

Browse files
committed
upgrade(tag): 0.0.5.PG
1 parent 4768f26 commit 4bef6df

File tree

8 files changed

+91
-25
lines changed

8 files changed

+91
-25
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: publish github release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseversion:
7+
description: 'Release version'
8+
required: true
9+
default: '0.0.1'
10+
11+
12+
jobs:
13+
publish-github-release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Create GitHub Release
19+
id: create_release
20+
uses: actions/create-release@v1
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
23+
with:
24+
tag_name: ${{ github.event.inputs.releaseversion }}
25+
release_name: ${{ github.event.inputs.releaseversion }}
26+
body: |
27+
### Things that changed in this release
28+
${{ steps.changelog.outputs.changelog }}
29+
draft: false
30+
prerelease: ${{ contains(github.event.inputs.releaseversion, '-') }}

.github/workflows/maven.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This workflow will build a Java project with Maven
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: nacos-datasource-plugin-pg
5+
6+
on:
7+
push:
8+
branches: [ master,dev ]
9+
pull_request:
10+
branches: [ master,dev ]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up JDK 8
18+
uses: actions/setup-java@v2
19+
with:
20+
java-version: '8'
21+
distribution: 'adopt'
22+
23+
- name: mvn clean install
24+
run: mvn clean install
25+
26+
- name: mvn spring-javaformat:validate
27+
run: mvn spring-javaformat:validate

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ application.properties 配置文件中 spring.datasource.platform 配置项选
1414

1515
> 依赖已上传 maven 中央仓库,请勿使用阿里云代理
1616
17-
| NACOS 版本 | 插件版本 |
18-
|---------------|-------|
19-
| 2.2.0 - 2.3.0 | 0.0.2 |
20-
| 2.3.1 - 2.3.2 | 0.0.3 |
17+
| NACOS 版本 | 插件版本 |
18+
|---------------|----------|
19+
| 2.2.0 - 2.3.0 | 0.0.2 |
20+
| 2.3.1 - 2.3.2 | 0.0.4.PG |
21+
| 2.4.0 - 2.4.1 | 0.0.5.PG |
2122

2223
```xml
2324

2425
<dependency>
2526
<groupId>com.pig4cloud.plugin</groupId>
2627
<artifactId>nacos-datasource-plugin-kingbase</artifactId>
27-
<version>0.0.3</version>
28+
<version>0.0.5.PG</version>
2829
</dependency>
2930

3031
<!--人大金仓数据库驱动-->
@@ -37,6 +38,8 @@ application.properties 配置文件中 spring.datasource.platform 配置项选
3738

3839
### 2. 导入 nacos 人大金仓 数据库脚本
3940

41+
- 请注意这里均使用 PG 协议测试,如有问题请自行修改脚本
42+
4043
- 特殊设置: kingbase.conf , '' null 的转换
4144

4245
```shell

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<modelVersion>4.0.0</modelVersion>
1212
<groupId>com.pig4cloud.plugin</groupId>
1313
<artifactId>nacos-datasource-plugin-kingbase</artifactId>
14-
<version>0.0.4.PG</version>
14+
<version>0.0.5.PG</version>
1515
<name>nacos-datasource-plugin-kingbase</name>
1616
<description>nacos 人大金仓存储支持插件</description>
1717
<url>https://pig4cloud.com</url>
@@ -25,7 +25,7 @@
2525
</licenses>
2626

2727
<properties>
28-
<nacos.version>2.3.2</nacos.version>
28+
<nacos.version>2.4.1</nacos.version>
2929
<spring.checkstyle.plugin>0.0.32</spring.checkstyle.plugin>
3030
<maven.compiler.version>3.8.1</maven.compiler.version>
3131
<maven.compiler.source>1.8</maven.compiler.source>

src/main/java/com/pig4cloud/plugin/impl/kingbase/ConfigInfoAggrMapperByKingbase.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ public MapperResult findConfigInfoAggrByPageFetchRows(MapperContext context) {
2121
String tenantId = (String) context.getWhereParameter(FieldConstant.TENANT_ID);
2222

2323
String sql = "SELECT data_id,group_id,tenant_id,datum_id,app_name,content FROM config_info_aggr WHERE data_id= ? AND "
24-
+ "group_id= ? AND tenant_id= ? ORDER BY datum_id LIMIT " + pageSize + " offset "
25-
+ startRow;
24+
+ "group_id= ? AND tenant_id= ? ORDER BY datum_id LIMIT " + pageSize + " offset " + startRow;
2625
List<Object> paramList = CollectionUtils.list(dataId, groupId, tenantId);
2726
return new MapperResult(sql, paramList);
2827
}

src/main/java/com/pig4cloud/plugin/impl/kingbase/ConfigInfoBetaMapperByKingbase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public MapperResult findAllConfigInfoBetaForDumpAllFetchRows(MapperContext conte
1616
int startRow = context.getStartRow();
1717
int pageSize = context.getPageSize();
1818
String sql = " SELECT t.id,data_id,group_id,tenant_id,app_name,content,md5,gmt_modified,beta_ips,encrypted_data_key "
19-
+ " FROM ( SELECT id FROM config_info_beta ORDER BY id LIMIT " + pageSize + " offset "
20-
+ startRow + " )" + " g, config_info_beta t WHERE g.id = t.id ";
19+
+ " FROM ( SELECT id FROM config_info_beta ORDER BY id LIMIT " + pageSize + " offset " + startRow
20+
+ " )" + " g, config_info_beta t WHERE g.id = t.id ";
2121
List<Object> paramList = new ArrayList<>();
2222
paramList.add(startRow);
2323
paramList.add(pageSize);

src/main/java/com/pig4cloud/plugin/impl/kingbase/ConfigInfoMapperByKingbase.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,22 @@ public MapperResult findConfigInfoByAppFetchRows(MapperContext context) {
3232
@Override
3333
public MapperResult getTenantIdList(MapperContext context) {
3434
String sql = "SELECT tenant_id FROM config_info WHERE tenant_id != '" + NamespaceUtil.getNamespaceDefaultId()
35-
+ "' GROUP BY tenant_id LIMIT " + context.getPageSize() + " offset "
36-
+ context.getStartRow();
35+
+ "' GROUP BY tenant_id LIMIT " + context.getPageSize() + " offset " + context.getStartRow();
3736
return new MapperResult(sql, Collections.emptyList());
3837
}
3938

4039
@Override
4140
public MapperResult getGroupIdList(MapperContext context) {
4241
String sql = "SELECT group_id FROM config_info WHERE tenant_id ='" + NamespaceUtil.getNamespaceDefaultId()
43-
+ "' GROUP BY group_id LIMIT " + context.getPageSize() + " offset "
44-
+ context.getStartRow();
42+
+ "' GROUP BY group_id LIMIT " + context.getPageSize() + " offset " + context.getStartRow();
4543
return new MapperResult(sql, Collections.emptyList());
4644
}
4745

4846
@Override
4947
public MapperResult findAllConfigKey(MapperContext context) {
5048
String sql = " SELECT data_id,group_id,app_name FROM ( "
5149
+ " SELECT id FROM config_info WHERE tenant_id LIKE ? ORDER BY id LIMIT " + context.getPageSize()
52-
+ " offset " + context.getStartRow() + " )"
53-
+ " g, config_info t WHERE g.id = t.id ";
50+
+ " offset " + context.getStartRow() + " )" + " g, config_info t WHERE g.id = t.id ";
5451
return new MapperResult(sql, CollectionUtils.list(context.getWhereParameter(FieldConstant.TENANT_ID)));
5552
}
5653

@@ -149,8 +146,9 @@ public MapperResult findConfigInfoBaseLikeFetchRows(MapperContext context) {
149146
where += " AND content LIKE ? ";
150147
paramList.add(content);
151148
}
152-
return new MapperResult(sqlFetchRows + where + " LIMIT " + context.getPageSize() + " offset "
153-
+ context.getStartRow(), paramList);
149+
return new MapperResult(
150+
sqlFetchRows + where + " LIMIT " + context.getPageSize() + " offset " + context.getStartRow(),
151+
paramList);
154152
}
155153

156154
@Override
@@ -183,8 +181,8 @@ public MapperResult findConfigInfo4PageFetchRows(MapperContext context) {
183181
where.append(" AND content LIKE ? ");
184182
paramList.add(content);
185183
}
186-
return new MapperResult(sql + where + " LIMIT " + context.getPageSize() + " offset "
187-
+ context.getStartRow(), paramList);
184+
return new MapperResult(sql + where + " LIMIT " + context.getPageSize() + " offset " + context.getStartRow(),
185+
paramList);
188186
}
189187

190188
@Override
@@ -227,8 +225,9 @@ public MapperResult findConfigInfoLike4PageFetchRows(MapperContext context) {
227225
where.append(" AND content LIKE ? ");
228226
paramList.add(content);
229227
}
230-
return new MapperResult(sqlFetchRows + where + " LIMIT " + context.getPageSize() + " offset "
231-
+ context.getStartRow(), paramList);
228+
return new MapperResult(
229+
sqlFetchRows + where + " LIMIT " + context.getPageSize() + " offset " + context.getStartRow(),
230+
paramList);
232231
}
233232

234233
@Override
@@ -245,6 +244,4 @@ public String getDataSource() {
245244
return DataSourceConstant.KINGBASE;
246245
}
247246

248-
249-
250247
}

src/main/java/com/pig4cloud/plugin/impl/kingbase/KingbaseAbstractMapper.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,14 @@ public String count(List<String> where) {
152152
return sql.toString();
153153
}
154154

155+
/**
156+
* Get function by functionName.
157+
* @param functionName functionName
158+
* @return function
159+
*/
160+
@Override
161+
public String getFunction(String functionName) {
162+
return "NOW()";
163+
}
164+
155165
}

0 commit comments

Comments
 (0)