Skip to content

Commit

Permalink
[apache#1339] feat(table): Add index for tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
Clearvive authored and Clearvive committed Jan 19, 2024
1 parent c8362f0 commit 517e797
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ public static Index unique(String[][] fieldNames) {
}

public static Index unique(String name, String[][] fieldNames) {
return IndexImpl.builder()
.withIndexType(Index.IndexType.UNIQUE_KEY)
.withName(name)
.withFieldNames(fieldNames)
.build();
return of(Index.IndexType.UNIQUE_KEY, name, fieldNames);
}

public static Index primary(String fieldName) {
Expand All @@ -38,17 +34,17 @@ public static Index primary(String[][] fieldNames) {
}

public static Index primary(String name, String[][] fieldNames) {
return of(Index.IndexType.PRIMARY_KEY, name, fieldNames);
}

public static Index of(Index.IndexType indexType, String name, String[][] fieldNames) {
return IndexImpl.builder()
.withIndexType(Index.IndexType.PRIMARY_KEY)
.withIndexType(indexType)
.withName(name)
.withFieldNames(fieldNames)
.build();
}

public static Index of(Index.IndexType indexType, String name, String[][] fieldNames) {
return new IndexImpl(indexType, name, fieldNames);
}

public static final class IndexImpl implements Index {
private final IndexType indexType;
private final String name;
Expand Down

0 comments on commit 517e797

Please sign in to comment.