Skip to content

Commit

Permalink
Add Collection State filter option (#166)
Browse files Browse the repository at this point in the history
Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia authored Jul 12, 2023
1 parent e1a31bb commit 2702b90
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions states/etcd/show/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"sort"
"strings"

"github.com/milvus-io/birdwatcher/framework"
"github.com/milvus-io/birdwatcher/models"
Expand All @@ -19,6 +20,7 @@ type CollectionParam struct {
CollectionID int64 `name:"id" default:"0" desc:"collection id to display"`
CollectionName string `name:"name" default:"" desc:"collection name to display"`
DatabaseID int64 `name:"dbid" default:"-1" desc:"database id to filter"`
State string `name:"state" default:"" desc:"collection state to filter"`
}

func (c *ComponentShow) CollectionCommand(ctx context.Context, p *CollectionParam) error {
Expand All @@ -40,6 +42,9 @@ func (c *ComponentShow) CollectionCommand(ctx context.Context, p *CollectionPara
if p.DatabaseID > -1 && coll.DBID != p.DatabaseID {
return false
}
if p.State != "" && strings.ToLower(p.State) != strings.ToLower(coll.State.String()) {
return false
}
total++
return true
})
Expand Down

0 comments on commit 2702b90

Please sign in to comment.