-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
4,979 additions
and
95 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
88 changes: 88 additions & 0 deletions
88
...n/extension-storage/src/main/java/io/holoinsight/server/extension/model/DetailResult.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,88 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
package io.holoinsight.server.extension.model; | ||
|
||
import lombok.Data; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* @author masaimu | ||
* @date 2023/8/11 | ||
*/ | ||
@Data | ||
public class DetailResult { | ||
|
||
List<String> tables; | ||
String sql; | ||
List<String> headers; | ||
List<DetailRow> points; | ||
|
||
public static DetailResult empty() { | ||
return new DetailResult(); | ||
} | ||
|
||
public boolean isEmpty() { | ||
return this.points == null || this.points.size() == 0; | ||
} | ||
|
||
public void add(DetailRow detailRow) { | ||
if (points == null) { | ||
points = new ArrayList<>(); | ||
} | ||
points.add(detailRow); | ||
} | ||
|
||
@Data | ||
public static class DetailRow { | ||
List<Value> values = new ArrayList<>(); | ||
|
||
public void addStringValue(String string) { | ||
Value value = new Value(DetailDataType.String, string); | ||
values.add(value); | ||
} | ||
|
||
public void addTimestampValue(long timestamp) { | ||
Value value = new Value(DetailDataType.Timestamp, timestamp); | ||
values.add(value); | ||
} | ||
|
||
public void addBooleanValue(boolean aBoolean) { | ||
Value value = new Value(DetailDataType.Boolean, aBoolean); | ||
values.add(value); | ||
} | ||
|
||
public void addNumValue(Object object) { | ||
if (object instanceof Number) { | ||
Value value = new Value(DetailDataType.Double, ((Number) object).doubleValue()); | ||
values.add(value); | ||
} | ||
} | ||
} | ||
|
||
@Data | ||
public static class Value { | ||
private final DetailDataType type; | ||
private final Object value; | ||
} | ||
|
||
public enum DetailDataType { | ||
String(String.class), // | ||
Boolean(Boolean.class), // | ||
Double(Double.class), // | ||
Timestamp(Long.class); // | ||
|
||
private final Class<?> javaType; | ||
|
||
DetailDataType(Class<?> javaType) { | ||
this.javaType = javaType; | ||
} | ||
|
||
public Class<?> getJavaType() { | ||
return javaType; | ||
} | ||
} | ||
|
||
} |
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
26 changes: 26 additions & 0 deletions
26
...on/src/main/java/io/holoinsight/server/home/common/service/query/QueryDetailResponse.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,26 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
package io.holoinsight.server.home.common.service.query; | ||
|
||
import lombok.Data; | ||
import java.util.List; | ||
|
||
/** | ||
* @author masaimu | ||
* @version 2023-08-15 12:57:00 | ||
*/ | ||
@Data | ||
public class QueryDetailResponse { | ||
|
||
private List<DetailResult> results; | ||
|
||
@Data | ||
public static class DetailResult { | ||
private List<String> tables; | ||
private String sql; | ||
private List<String> headers; | ||
private List<Object[]> values; | ||
|
||
} | ||
} |
Oops, something went wrong.