-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade(version): 0.0.4 适配 nacos 2.4.1
注意更新SQL , users 表字段不兼容
- Loading branch information
Showing
4 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/com/pig4cloud/plugin/impl/postgresql/TrustedPgFunctionEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.pig4cloud.plugin.impl.postgresql; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author lengleng | ||
* @date 2024/8/25 | ||
*/ | ||
public enum TrustedPgFunctionEnum { | ||
|
||
/** | ||
* NOW(). | ||
*/ | ||
NOW("NOW()", "NOW()"); | ||
|
||
private static final Map<String, TrustedPgFunctionEnum> LOOKUP_MAP = new HashMap<>(); | ||
|
||
static { | ||
for (TrustedPgFunctionEnum entry : TrustedPgFunctionEnum.values()) { | ||
LOOKUP_MAP.put(entry.functionName, entry); | ||
} | ||
} | ||
|
||
private final String functionName; | ||
|
||
private final String function; | ||
|
||
TrustedPgFunctionEnum(String functionName, String function) { | ||
this.functionName = functionName; | ||
this.function = function; | ||
} | ||
|
||
/** | ||
* Get the function name. | ||
* @param functionName function name | ||
* @return function | ||
*/ | ||
public static String getFunctionByName(String functionName) { | ||
TrustedPgFunctionEnum entry = LOOKUP_MAP.get(functionName); | ||
if (entry != null) { | ||
return entry.function; | ||
} | ||
throw new IllegalArgumentException(String.format("Invalid function name: %s", functionName)); | ||
} | ||
|
||
} |