Skip to content

Commit

Permalink
♻️ refactor: updated apix for clusters #9
Browse files Browse the repository at this point in the history
  • Loading branch information
pnguyen215 committed Dec 2, 2023
1 parent f6abacb commit 6aebc86
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions apix/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,9 @@ func isDuration(t time.Duration) bool {
return t != 0 && t > 0
}

func Get(node []ApiRequestConfig, key string) ApiRequestConfig {
if len(node) == 0 {
return ApiRequestConfig{}
func Get(node []ApiRequestConfig, key string) (ApiRequestConfig, bool) {
if len(node) == 0 || utils.IsEmpty(key) {
return ApiRequestConfig{}, false
}
var value ApiRequestConfig
for _, v := range node {
Expand All @@ -477,5 +477,8 @@ func Get(node []ApiRequestConfig, key string) ApiRequestConfig {
break
}
}
return value
if utils.IsEmpty(value.Key) {
return ApiRequestConfig{}, false
}
return value, true
}

0 comments on commit 6aebc86

Please sign in to comment.