diff --git a/states/etcd/show/database.go b/states/etcd/show/database.go index fff0403..5f36b6e 100644 --- a/states/etcd/show/database.go +++ b/states/etcd/show/database.go @@ -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())