Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: code format #17

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/ly/ckibana/handlers/ParamHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public String doHandle(RequestContext context) {
}

String body = proxyConfigLoader.getYaml().dumpAs(kibanaProperty, Tag.MAP, DumperOptions.FlowStyle.BLOCK);
String response = EsClientUtil.saveOne(proxyConfigLoader.getMetadataRestClient(), proxyConfigLoader.getSettingsIndexName(),
String response = EsClientUtil.saveOne(proxyConfigLoader.getMetadataRestClient(), proxyConfigLoader.getSettingsIndexName(),
"kibana",
Map.of(
"key", "kibana",
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/ly/ckibana/util/DateUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.sql.Timestamp;

@Slf4j
public class DateUtils {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/ly/ckibana/util/ProxyUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public static Range getRangeWrappedBySqlFunction(Range orgRange, boolean isTimeF
*/
public static String generateTimeFieldSqlWithFormatDateTime64ZoneShangHai(Object value, String ckFieldType) {
if (SqlUtils.isDateTime64(ckFieldType)) {
return String.format("toDateTime64(%s/1000,%d)", value.toString(),SqlUtils.getDateTime64Scale(ckFieldType));
return String.format("toDateTime64(%s/1000,%d)", value.toString(), SqlUtils.getDateTime64Scale(ckFieldType));
} else if (SqlUtils.isDateTime(ckFieldType)) {
return String.format("toDateTime(%s/1000)", value.toString());
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/ly/ckibana/util/RestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static RestClient initEsRestClient(String host, Map<String, String> heade
if (each.contains(":")) {
String[] splits = each.split(":");
hosts[i] = new HttpHost(splits[0], Integer.parseInt(splits[1]));
}else {
} else {
hosts[i] = new HttpHost(host);
}
}
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/com/ly/ckibana/util/SqlUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ public static String getSelectTemplate(String selectSql, String table) {
return String.format("SELECT %s FROM %s", selectSql, table);
}


/**
* 是否为DateTime64时间类型.
*
Expand All @@ -418,17 +417,16 @@ public static boolean isDateTime64(String ckFieldType) {
return StringUtils.startsWith(ckFieldType, SqlConstants.TYPE_DATETIME64);
}


/**
* DateTime64时间类型,提取精度
* DateTime64时间类型,提取精度.
*
* @param ckFieldType ck字段类型,如DateTime64(3)
* @return 精度,如3
*/
public static int getDateTime64Scale(String ckFieldType) {
String scale= ckFieldType.replace(SqlConstants.TYPE_DATETIME64,StringUtils.EMPTY)
.replace(Constants.Symbol.LEFT_PARENTHESIS,StringUtils.EMPTY)
.replace(Constants.Symbol.RIGHT_PARENTHESIS,StringUtils.EMPTY);
String scale = ckFieldType.replace(SqlConstants.TYPE_DATETIME64, StringUtils.EMPTY)
.replace(Constants.Symbol.LEFT_PARENTHESIS, StringUtils.EMPTY)
.replace(Constants.Symbol.RIGHT_PARENTHESIS, StringUtils.EMPTY);
return Integer.parseInt(scale);
}
/**
Expand Down