Skip to content

Commit

Permalink
upgrade(tag): 0.0.5.PG
Browse files Browse the repository at this point in the history
  • Loading branch information
lltx committed Aug 25, 2024
1 parent 4768f26 commit 4bef6df
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 25 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: publish github release

on:
workflow_dispatch:
inputs:
releaseversion:
description: 'Release version'
required: true
default: '0.0.1'


jobs:
publish-github-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ github.event.inputs.releaseversion }}
release_name: ${{ github.event.inputs.releaseversion }}
body: |
### Things that changed in this release
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: ${{ contains(github.event.inputs.releaseversion, '-') }}
27 changes: 27 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: nacos-datasource-plugin-pg

on:
push:
branches: [ master,dev ]
pull_request:
branches: [ master,dev ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'

- name: mvn clean install
run: mvn clean install

- name: mvn spring-javaformat:validate
run: mvn spring-javaformat:validate
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ application.properties 配置文件中 spring.datasource.platform 配置项选

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

```xml

<dependency>
<groupId>com.pig4cloud.plugin</groupId>
<artifactId>nacos-datasource-plugin-kingbase</artifactId>
<version>0.0.3</version>
<version>0.0.5.PG</version>
</dependency>

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

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

- 请注意这里均使用 PG 协议测试,如有问题请自行修改脚本

- 特殊设置: kingbase.conf , '' null 的转换

```shell
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.pig4cloud.plugin</groupId>
<artifactId>nacos-datasource-plugin-kingbase</artifactId>
<version>0.0.4.PG</version>
<version>0.0.5.PG</version>
<name>nacos-datasource-plugin-kingbase</name>
<description>nacos 人大金仓存储支持插件</description>
<url>https://pig4cloud.com</url>
Expand All @@ -25,7 +25,7 @@
</licenses>

<properties>
<nacos.version>2.3.2</nacos.version>
<nacos.version>2.4.1</nacos.version>
<spring.checkstyle.plugin>0.0.32</spring.checkstyle.plugin>
<maven.compiler.version>3.8.1</maven.compiler.version>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public MapperResult findConfigInfoAggrByPageFetchRows(MapperContext context) {
String tenantId = (String) context.getWhereParameter(FieldConstant.TENANT_ID);

String sql = "SELECT data_id,group_id,tenant_id,datum_id,app_name,content FROM config_info_aggr WHERE data_id= ? AND "
+ "group_id= ? AND tenant_id= ? ORDER BY datum_id LIMIT " + pageSize + " offset "
+ startRow;
+ "group_id= ? AND tenant_id= ? ORDER BY datum_id LIMIT " + pageSize + " offset " + startRow;
List<Object> paramList = CollectionUtils.list(dataId, groupId, tenantId);
return new MapperResult(sql, paramList);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public MapperResult findAllConfigInfoBetaForDumpAllFetchRows(MapperContext conte
int startRow = context.getStartRow();
int pageSize = context.getPageSize();
String sql = " SELECT t.id,data_id,group_id,tenant_id,app_name,content,md5,gmt_modified,beta_ips,encrypted_data_key "
+ " FROM ( SELECT id FROM config_info_beta ORDER BY id LIMIT " + pageSize + " offset "
+ startRow + " )" + " g, config_info_beta t WHERE g.id = t.id ";
+ " FROM ( SELECT id FROM config_info_beta ORDER BY id LIMIT " + pageSize + " offset " + startRow
+ " )" + " g, config_info_beta t WHERE g.id = t.id ";
List<Object> paramList = new ArrayList<>();
paramList.add(startRow);
paramList.add(pageSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,22 @@ public MapperResult findConfigInfoByAppFetchRows(MapperContext context) {
@Override
public MapperResult getTenantIdList(MapperContext context) {
String sql = "SELECT tenant_id FROM config_info WHERE tenant_id != '" + NamespaceUtil.getNamespaceDefaultId()
+ "' GROUP BY tenant_id LIMIT " + context.getPageSize() + " offset "
+ context.getStartRow();
+ "' GROUP BY tenant_id LIMIT " + context.getPageSize() + " offset " + context.getStartRow();
return new MapperResult(sql, Collections.emptyList());
}

@Override
public MapperResult getGroupIdList(MapperContext context) {
String sql = "SELECT group_id FROM config_info WHERE tenant_id ='" + NamespaceUtil.getNamespaceDefaultId()
+ "' GROUP BY group_id LIMIT " + context.getPageSize() + " offset "
+ context.getStartRow();
+ "' GROUP BY group_id LIMIT " + context.getPageSize() + " offset " + context.getStartRow();
return new MapperResult(sql, Collections.emptyList());
}

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

Expand Down Expand Up @@ -149,8 +146,9 @@ public MapperResult findConfigInfoBaseLikeFetchRows(MapperContext context) {
where += " AND content LIKE ? ";
paramList.add(content);
}
return new MapperResult(sqlFetchRows + where + " LIMIT " + context.getPageSize() + " offset "
+ context.getStartRow(), paramList);
return new MapperResult(
sqlFetchRows + where + " LIMIT " + context.getPageSize() + " offset " + context.getStartRow(),
paramList);
}

@Override
Expand Down Expand Up @@ -183,8 +181,8 @@ public MapperResult findConfigInfo4PageFetchRows(MapperContext context) {
where.append(" AND content LIKE ? ");
paramList.add(content);
}
return new MapperResult(sql + where + " LIMIT " + context.getPageSize() + " offset "
+ context.getStartRow(), paramList);
return new MapperResult(sql + where + " LIMIT " + context.getPageSize() + " offset " + context.getStartRow(),
paramList);
}

@Override
Expand Down Expand Up @@ -227,8 +225,9 @@ public MapperResult findConfigInfoLike4PageFetchRows(MapperContext context) {
where.append(" AND content LIKE ? ");
paramList.add(content);
}
return new MapperResult(sqlFetchRows + where + " LIMIT " + context.getPageSize() + " offset "
+ context.getStartRow(), paramList);
return new MapperResult(
sqlFetchRows + where + " LIMIT " + context.getPageSize() + " offset " + context.getStartRow(),
paramList);
}

@Override
Expand All @@ -245,6 +244,4 @@ public String getDataSource() {
return DataSourceConstant.KINGBASE;
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,14 @@ public String count(List<String> where) {
return sql.toString();
}

/**
* Get function by functionName.
* @param functionName functionName
* @return function
*/
@Override
public String getFunction(String functionName) {
return "NOW()";
}

}

0 comments on commit 4bef6df

Please sign in to comment.