mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-29 02:32:33 +08:00
add pg index
This commit is contained in:
@ -291,6 +291,7 @@ public class PostgreSQLMetaData extends DefaultMetaService implements MetaData {
|
||||
.columnTypes(PostgreSQLColumnTypeEnum.getTypes())
|
||||
.charsets(PostgreSQLCharsetEnum.getCharsets())
|
||||
.collations(PostgreSQLCollationEnum.getCollations())
|
||||
.indexTypes(PostgreSQLIndexTypeEnum.getIndexTypes())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user