Skip to content

Commit

Permalink
databases: Fix DatabaseOptions.KV function (#1433)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Starr-Bochicchio <[email protected]>
  • Loading branch information
alexandear and andrewsomething authored Oct 10, 2023
1 parent 1d2e1ea commit 2e44c23
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 2e44c23

Please sign in to comment.