Skip to content

Commit

Permalink
rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
BaruchBilanski committed Jan 1, 2024
1 parent d205a9a commit 2ce0acb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions aquasec/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,34 @@ func convertStringArr(ifaceArr []interface{}) []string {
return convertAndMapStringArr(ifaceArr, func(s string) string { return s })
}

func convertStringArrNull(ifaceArr []interface{}) []string {
return convertAndMapStringArrNull(ifaceArr, func(s string) string { return s })

}

func convertIntArr(ifaceArr []interface{}) []int {
return convertAndMapIntArr(ifaceArr, func(i int) int { return i })
}

func convertAndMapIntArr(ifaceArr []interface{}, mapper func(int) int) []int {
intArr := make([]int, len(ifaceArr))
for i, val := range ifaceArr {
intArr[i] = mapper(val.(int))
}
return intArr
}

func convertAndMapStringArrNull(ifaceArr []interface{}, f func(string) string) []string {
var arr = make([]string, 0)
for _, v := range ifaceArr {
if v == nil {
continue
}
arr = append(arr, f(v.(string)))
}
return arr
}

func convertStringArrTest(ifaceArr []interface{}) []string {
var result []string
for _, iface := range ifaceArr {
Expand Down

0 comments on commit 2ce0acb

Please sign in to comment.