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: Support show database filter with dbid #290

Merged
Merged
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
3 changes: 2 additions & 1 deletion states/etcd/show/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ import (

type DatabaseParam struct {
framework.ParamBase `use:"show database" desc:"display Database info from rootcoord meta"`
DatabaseID int64 `name:"id" default:"0" desc:"database id to filter with"`
DatabaseName string `name:"name" default:"" desc:"database name to filter with"`
}

// DatabaseCommand returns show database comand.
func (c *ComponentShow) DatabaseCommand(ctx context.Context, p *DatabaseParam) (*Databases, error) {
dbs, err := common.ListDatabase(ctx, c.client, c.basePath, func(db *models.Database) bool {
return p.DatabaseName == "" || db.Name == p.DatabaseName
return (p.DatabaseName == "" || db.Name == p.DatabaseName) && (p.DatabaseID == 0 || db.ID == p.DatabaseID)
})
if err != nil {
fmt.Println("failed to list database info", err.Error())
Expand Down
Loading