add pg index

This commit is contained in:
SwallowGG
2023-10-14 13:25:15 +08:00
parent d4cdbcf8e6
commit 501475ea1b
2 changed files with 16 additions and 0 deletions

View File

@ -291,6 +291,7 @@ public class PostgreSQLMetaData extends DefaultMetaService implements MetaData {
.columnTypes(PostgreSQLColumnTypeEnum.getTypes())
.charsets(PostgreSQLCharsetEnum.getCharsets())
.collations(PostgreSQLCollationEnum.getCollations())
.indexTypes(PostgreSQLIndexTypeEnum.getIndexTypes())
.build();
}
}

View File

@ -1,12 +1,16 @@
package ai.chat2db.plugin.postgresql.type;
import ai.chat2db.spi.enums.EditStatus;
import ai.chat2db.spi.model.IndexType;
import ai.chat2db.spi.model.TableIndex;
import ai.chat2db.spi.model.TableIndexColumn;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.List;
public enum PostgreSQLIndexTypeEnum {
PRIMARY("Primary", "PRIMARY KEY"),
@ -21,10 +25,13 @@ public enum PostgreSQLIndexTypeEnum {
private String name;
private String keyword;
private IndexType indexType;
PostgreSQLIndexTypeEnum(String name, String keyword) {
this.name = name;
this.keyword = keyword;
this.indexType =new IndexType(name);
}
public static PostgreSQLIndexTypeEnum getByType(String type) {
@ -36,6 +43,14 @@ public enum PostgreSQLIndexTypeEnum {
return null;
}
public static List<IndexType> getIndexTypes() {
return Arrays.asList(PostgreSQLIndexTypeEnum.values()).stream().map(PostgreSQLIndexTypeEnum::getIndexType).collect(java.util.stream.Collectors.toList());
}
public IndexType getIndexType() {
return indexType;
}
public String getName() {
return name;
}