Skip to content

Commit db84c29

Browse files
committed
merge
2 parents a5a2a4c + 1d6034f commit db84c29

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

chat2db-server/chat2db-plugins/chat2db-postgresql/src/main/java/ai/chat2db/plugin/postgresql/PostgreSQLMetaData.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ public TableMeta getTableMeta(String databaseName, String schemaName, String tab
291291
.columnTypes(PostgreSQLColumnTypeEnum.getTypes())
292292
.charsets(PostgreSQLCharsetEnum.getCharsets())
293293
.collations(PostgreSQLCollationEnum.getCollations())
294+
.indexTypes(PostgreSQLIndexTypeEnum.getIndexTypes())
294295
.build();
295296
}
296297
}

chat2db-server/chat2db-plugins/chat2db-postgresql/src/main/java/ai/chat2db/plugin/postgresql/type/PostgreSQLIndexTypeEnum.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package ai.chat2db.plugin.postgresql.type;
22

33
import ai.chat2db.spi.enums.EditStatus;
4+
import ai.chat2db.spi.model.IndexType;
45
import ai.chat2db.spi.model.TableIndex;
56
import ai.chat2db.spi.model.TableIndexColumn;
67
import org.apache.commons.collections4.CollectionUtils;
78
import org.apache.commons.lang3.BooleanUtils;
89
import org.apache.commons.lang3.StringUtils;
910

11+
import java.util.Arrays;
12+
import java.util.List;
13+
1014
public enum PostgreSQLIndexTypeEnum {
1115

1216
PRIMARY("Primary", "PRIMARY KEY"),
@@ -21,10 +25,13 @@ public enum PostgreSQLIndexTypeEnum {
2125
private String name;
2226
private String keyword;
2327

28+
private IndexType indexType;
29+
2430

2531
PostgreSQLIndexTypeEnum(String name, String keyword) {
2632
this.name = name;
2733
this.keyword = keyword;
34+
this.indexType =new IndexType(name);
2835
}
2936

3037
public static PostgreSQLIndexTypeEnum getByType(String type) {
@@ -36,6 +43,14 @@ public static PostgreSQLIndexTypeEnum getByType(String type) {
3643
return null;
3744
}
3845

46+
public static List<IndexType> getIndexTypes() {
47+
return Arrays.asList(PostgreSQLIndexTypeEnum.values()).stream().map(PostgreSQLIndexTypeEnum::getIndexType).collect(java.util.stream.Collectors.toList());
48+
}
49+
50+
public IndexType getIndexType() {
51+
return indexType;
52+
}
53+
3954
public String getName() {
4055
return name;
4156
}

0 commit comments

Comments
 (0)