From d5bcfd99d20ad2b64a193c69025208d37deb6296 Mon Sep 17 00:00:00 2001 From: congqixia Date: Mon, 26 Jun 2023 16:26:39 +0800 Subject: [PATCH] Add Collection create time in show collection result (#159) Signed-off-by: Congqi Xia --- bapps/go_prompt_parser.go | 1 + states/etcd/show/collection.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bapps/go_prompt_parser.go b/bapps/go_prompt_parser.go index ef738ad..096dd8d 100644 --- a/bapps/go_prompt_parser.go +++ b/bapps/go_prompt_parser.go @@ -42,5 +42,6 @@ func HandleFD(p *prompt.Prompt) error { } func GetUnexportedField(field reflect.Value) interface{} { + // nolint return reflect.NewAt(field.Type(), unsafe.Pointer(field.UnsafeAddr())).Elem().Interface() } diff --git a/states/etcd/show/collection.go b/states/etcd/show/collection.go index 2041dc1..304b154 100644 --- a/states/etcd/show/collection.go +++ b/states/etcd/show/collection.go @@ -11,6 +11,7 @@ import ( "github.com/milvus-io/birdwatcher/models" "github.com/milvus-io/birdwatcher/states/etcd/common" etcdversion "github.com/milvus-io/birdwatcher/states/etcd/version" + "github.com/milvus-io/birdwatcher/utils" ) // CollectionCommand returns sub command for showCmd. @@ -81,7 +82,8 @@ func CollectionCommand(cli clientv3.KV, basePath string) *cobra.Command { func printCollection(collection *models.Collection) { fmt.Println("================================================================================") fmt.Printf("Collection ID: %d\tCollection Name: %s\n", collection.ID, collection.Schema.Name) - fmt.Printf("Collection State: %s\n", collection.State.String()) + t, _ := utils.ParseTS(collection.CreateTime) + fmt.Printf("Collection State: %s\tCreate Time: %s\n", collection.State.String(), t.Format("2006-01-02 15:04:05")) /* fmt.Printf("Partitions:\n") for idx, partID := range collection.GetPartitionIDs() {