Skip to content

Commit

Permalink
🔖 Releasing / Version tags. 瀚高数据库 支持
Browse files Browse the repository at this point in the history
  • Loading branch information
lbw committed Apr 25, 2023
1 parent 1bf0d48 commit 8f146bd
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 59 deletions.
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,50 @@ Nacos 从 2.2.0 版本开始,可通过 SPI 机制注入多数据源实现插件,
![](https://minio.pigx.vip/oss/202212/1671180565.png)

## 自定义 PostgreSQL 插件
## 自定义 highgo 插件

### 1. 添加 postgresql 插件
### 1. 添加 highgo 插件

> 依赖已上传 maven 中央仓库,请勿使用阿里云代理
```xml
<dependency>
<groupId>com.pig4cloud.plugin</groupId>
<artifactId>nacos-datasource-plugin-pg</artifactId>
<artifactId>nacos-datasource-plugin-highgo</artifactId>
<version>0.0.1</version>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<groupId>com.highgo</groupId>
<artifactId>HgdbJdbc</artifactId>
<version>6.2.0</version>
</dependency>
```

### 2. 导入 nacos postgresql 数据库脚本
### 2. 导入 nacos highgo 数据库脚本

./sql/nacos-pg.sql
./sql/nacos-highgo.sql

### 3. 配置 nacos 数据源链接信息

```yaml
db:
num: 1
url:
0: jdbc:postgresql://172.27.0.5:5432/pigxx_config
user:
0: postgres
password:
0: 123456
0: jdbc:highgo://172.27.0.5:5866/highgo?currentSchema=nacos
user: highgo
password: Highgo@123
pool:
config:
driver-class-name: org.postgresql.Driver
driver-class-name: com.highgo.jdbc.Driver
```
### 4. 指定 nacos 数据源平台
```yaml
spring:
datasource:
platform: postgresql
platform: highgo
```
![](https://minio.pigx.vip/oss/202212/1671184577.png)
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.6</version>
<version>2.7.11</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.pig4cloud.plugin</groupId>
<artifactId>nacos-datasource-plugin-pg</artifactId>
<artifactId>nacos-datasource-plugin-highgo</artifactId>
<version>0.0.2-SNAPSHOT</version>
<name>nacos-datasource-plugin-pg</name>
<description>nacos-datasource-plugin-pg</description>
<name>nacos-datasource-plugin-highgo</name>
<description>nacos 瀚高数据库存储插件</description>
<url>https://pig4cloud.com</url>

<licenses>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@

public class DataSourceConstant {

public static final String MYSQL = "mysql";

public static final String DERBY = "derby";

public static final String POSTGRESQL = "postgresql";
public static final String HIGHGO = "highgo";

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pig4cloud.plugin.impl.postgresql;
package com.pig4cloud.plugin.impl.highgo;

import com.alibaba.nacos.plugin.datasource.constants.TableConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
Expand All @@ -7,7 +7,7 @@

import java.util.List;

public class ConfigInfoAggrMapperByPostgresql extends AbstractMapper implements ConfigInfoAggrMapper {
public class ConfigInfoAggrMapperByHighgo extends AbstractMapper implements ConfigInfoAggrMapper {

/**
* 批量删除
Expand Down Expand Up @@ -70,7 +70,7 @@ public String getTableName() {

@Override
public String getDataSource() {
return DataSourceConstant.POSTGRESQL;
return DataSourceConstant.HIGHGO;
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.pig4cloud.plugin.impl.postgresql;
package com.pig4cloud.plugin.impl.highgo;

import com.alibaba.nacos.plugin.datasource.constants.TableConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.ConfigInfoBetaMapper;
import com.pig4cloud.plugin.constants.DataSourceConstant;

public class ConfigInfoBetaMapperByPostgresql extends AbstractMapper implements ConfigInfoBetaMapper {
public class ConfigInfoBetaMapperByHighgo extends AbstractMapper implements ConfigInfoBetaMapper {

@Override
public String updateConfigInfo4BetaCas() {
Expand All @@ -27,7 +27,7 @@ public String getTableName() {

@Override
public String getDataSource() {
return DataSourceConstant.POSTGRESQL;
return DataSourceConstant.HIGHGO;
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pig4cloud.plugin.impl.postgresql;
package com.pig4cloud.plugin.impl.highgo;

import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.StringUtils;
Expand All @@ -12,7 +12,7 @@
import java.util.List;
import java.util.Map;

public class ConfigInfoMapperByPostgresql extends AbstractMapper implements ConfigInfoMapper {
public class ConfigInfoMapperByHighgo extends AbstractMapper implements ConfigInfoMapper {

private static final String DATA_ID = "dataId";

Expand Down Expand Up @@ -374,7 +374,7 @@ public String getTableName() {

@Override
public String getDataSource() {
return DataSourceConstant.POSTGRESQL;
return DataSourceConstant.HIGHGO;
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.pig4cloud.plugin.impl.postgresql;
package com.pig4cloud.plugin.impl.highgo;

import com.alibaba.nacos.plugin.datasource.constants.TableConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.ConfigInfoTagMapper;
import com.pig4cloud.plugin.constants.DataSourceConstant;

public class ConfigInfoTagMapperByPostgresql extends AbstractMapper implements ConfigInfoTagMapper {
public class ConfigInfoTagMapperByHighgo extends AbstractMapper implements ConfigInfoTagMapper {

@Override
public String updateConfigInfo4TagCas() {
Expand All @@ -27,7 +27,7 @@ public String getTableName() {

@Override
public String getDataSource() {
return DataSourceConstant.POSTGRESQL;
return DataSourceConstant.HIGHGO;
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pig4cloud.plugin.impl.postgresql;
package com.pig4cloud.plugin.impl.highgo;

import com.alibaba.nacos.common.utils.StringUtils;
import com.alibaba.nacos.plugin.datasource.constants.TableConstant;
Expand All @@ -8,7 +8,7 @@

import java.util.Map;

public class ConfigTagsRelationMapperByPostgresql extends AbstractMapper implements ConfigTagsRelationMapper {
public class ConfigTagsRelationMapperByHighgo extends AbstractMapper implements ConfigTagsRelationMapper {

@Override
public String findConfigInfo4PageCountRows(final Map<String, String> params, final int tagSize) {
Expand Down Expand Up @@ -147,7 +147,7 @@ public String getTableName() {

@Override
public String getDataSource() {
return DataSourceConstant.POSTGRESQL;
return DataSourceConstant.HIGHGO;
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.pig4cloud.plugin.impl.postgresql;
package com.pig4cloud.plugin.impl.highgo;

import com.alibaba.nacos.plugin.datasource.constants.TableConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.GroupCapacityMapper;
import com.pig4cloud.plugin.constants.DataSourceConstant;

public class GroupCapacityMapperByPostgresql extends AbstractMapper implements GroupCapacityMapper {
public class GroupCapacityMapperByHighgo extends AbstractMapper implements GroupCapacityMapper {

@Override
public String insertIntoSelect() {
Expand Down Expand Up @@ -62,7 +62,7 @@ public String getTableName() {

@Override
public String getDataSource() {
return DataSourceConstant.POSTGRESQL;
return DataSourceConstant.HIGHGO;
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.pig4cloud.plugin.impl.postgresql;
package com.pig4cloud.plugin.impl.highgo;

import com.alibaba.nacos.plugin.datasource.constants.TableConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.HistoryConfigInfoMapper;
import com.pig4cloud.plugin.constants.DataSourceConstant;

public class HistoryConfigInfoMapperByPostgresql extends AbstractMapper implements HistoryConfigInfoMapper {
public class HistoryConfigInfoMapperByHighgo extends AbstractMapper implements HistoryConfigInfoMapper {

@Override
public String removeConfigHistory() {
Expand Down Expand Up @@ -41,7 +41,7 @@ public String getTableName() {

@Override
public String getDataSource() {
return DataSourceConstant.POSTGRESQL;
return DataSourceConstant.HIGHGO;
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.pig4cloud.plugin.impl.postgresql;
package com.pig4cloud.plugin.impl.highgo;

import com.alibaba.nacos.plugin.datasource.constants.TableConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.TenantCapacityMapper;
import com.pig4cloud.plugin.constants.DataSourceConstant;

public class TenantCapacityMapperByPostgresql extends AbstractMapper implements TenantCapacityMapper {
public class TenantCapacityMapperByHighgo extends AbstractMapper implements TenantCapacityMapper {

@Override
public String incrementUsageWithDefaultQuotaLimit() {
Expand Down Expand Up @@ -53,7 +53,7 @@ public String getTableName() {

@Override
public String getDataSource() {
return DataSourceConstant.POSTGRESQL;
return DataSourceConstant.HIGHGO;
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.pig4cloud.plugin.impl.postgresql;
package com.pig4cloud.plugin.impl.highgo;

import com.alibaba.nacos.plugin.datasource.constants.TableConstant;
import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper;
import com.alibaba.nacos.plugin.datasource.mapper.TenantInfoMapper;
import com.pig4cloud.plugin.constants.DataSourceConstant;

public class TenantInfoMapperByPostgresql extends AbstractMapper implements TenantInfoMapper {
public class TenantInfoMapperByHighgo extends AbstractMapper implements TenantInfoMapper {

@Override
public String getTableName() {
Expand All @@ -14,7 +14,7 @@ public String getTableName() {

@Override
public String getDataSource() {
return DataSourceConstant.POSTGRESQL;
return DataSourceConstant.HIGHGO;
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
com.pig4cloud.plugin.impl.postgresql.ConfigInfoAggrMapperByPostgresql
com.pig4cloud.plugin.impl.postgresql.ConfigInfoBetaMapperByPostgresql
com.pig4cloud.plugin.impl.postgresql.ConfigInfoMapperByPostgresql
com.pig4cloud.plugin.impl.postgresql.ConfigInfoTagMapperByPostgresql
com.pig4cloud.plugin.impl.postgresql.ConfigTagsRelationMapperByPostgresql
com.pig4cloud.plugin.impl.postgresql.HistoryConfigInfoMapperByPostgresql
com.pig4cloud.plugin.impl.postgresql.TenantInfoMapperByPostgresql
com.pig4cloud.plugin.impl.postgresql.TenantCapacityMapperByPostgresql
com.pig4cloud.plugin.impl.postgresql.GroupCapacityMapperByPostgresql
com.pig4cloud.plugin.impl.highgo.ConfigInfoAggrMapperByHighgo
com.pig4cloud.plugin.impl.highgo.ConfigInfoBetaMapperByHighgo
com.pig4cloud.plugin.impl.highgo.ConfigInfoMapperByHighgo
com.pig4cloud.plugin.impl.highgo.ConfigInfoTagMapperByHighgo
com.pig4cloud.plugin.impl.highgo.ConfigTagsRelationMapperByHighgo
com.pig4cloud.plugin.impl.highgo.HistoryConfigInfoMapperByHighgo
com.pig4cloud.plugin.impl.highgo.TenantInfoMapperByHighgo
com.pig4cloud.plugin.impl.highgo.TenantCapacityMapperByHighgo
com.pig4cloud.plugin.impl.highgo.GroupCapacityMapperByHighgo

0 comments on commit 8f146bd

Please sign in to comment.