Skip to content

Commit

Permalink
databases: Fix DatabaseOptions.KV function
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed Oct 10, 2023
1 parent d082b6c commit 1f0ebc8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions commands/displayers/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,19 +333,22 @@ func (do *DatabaseOptions) ColMap() map[string]string {

func (do *DatabaseOptions) KV() []map[string]interface{} {
engines := make([]string, 0)
if &do.DatabaseOptions.MongoDBOptions != nil {
nonEmptyOptionsFn := func(opt godo.DatabaseEngineOptions) bool {
return len(opt.Layouts) > 0 || len(opt.Regions) > 0 || len(opt.Versions) > 0
}
if nonEmptyOptionsFn(do.DatabaseOptions.MongoDBOptions) {
engines = append(engines, "mongodb")
}
if &do.DatabaseOptions.RedisOptions != nil {
if nonEmptyOptionsFn(do.DatabaseOptions.RedisOptions) {
engines = append(engines, "redis")
}
if &do.DatabaseOptions.MySQLOptions != nil {
if nonEmptyOptionsFn(do.DatabaseOptions.MySQLOptions) {
engines = append(engines, "mysql")
}
if &do.DatabaseOptions.PostgresSQLOptions != nil {
if nonEmptyOptionsFn(do.DatabaseOptions.PostgresSQLOptions) {
engines = append(engines, "pg")
}
if &do.DatabaseOptions.KafkaOptions != nil {
if nonEmptyOptionsFn(do.DatabaseOptions.KafkaOptions) {
engines = append(engines, "kafka")
}

Expand Down

0 comments on commit 1f0ebc8

Please sign in to comment.