Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: Display collection clustering key info #285

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions models/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func NewCollectionFromV2_2(info *etcdpbv2.CollectionInfo, key string, fields []*
fs.Properties = GetMapFromKVPairs(fieldSchema.GetTypeParams())
fs.IsDynamic = fieldSchema.GetIsDynamic()
fs.IsPartitionKey = fieldSchema.GetIsPartitionKey()
fs.IsClusteringKey = fieldSchema.GetIsClusteringKey()
return fs
})
c.Schema.EnableDynamicSchema = info.GetSchema().GetEnableDynamicField()
Expand Down
19 changes: 10 additions & 9 deletions models/collection_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ type CollectionSchema struct {
}

type FieldSchema struct {
FieldID int64
Name string
IsPrimaryKey bool
AutoID bool
DataType DataType
Description string
Properties map[string]string
IsDynamic bool
IsPartitionKey bool
FieldID int64
Name string
IsPrimaryKey bool
AutoID bool
DataType DataType
Description string
Properties map[string]string
IsDynamic bool
IsPartitionKey bool
IsClusteringKey bool
}

func (fs *FieldSchema) GetDim() (int64, error) {
Expand Down
3 changes: 3 additions & 0 deletions states/etcd/show/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ func printCollection(sb *strings.Builder, collection *models.Collection) {
if field.IsPartitionKey {
fmt.Printf("\t - Partition Key\n")
}
if field.IsClusteringKey {
fmt.Printf("\t - Clustering Key\n")
}
for key, value := range field.Properties {
fmt.Printf("\t - Type Param %s: %s\n", key, value)
}
Expand Down
Loading