Skip to content

Commit

Permalink
Merge pull request #4 from pluralsh/fix-stringarrptr
Browse files Browse the repository at this point in the history
Fix stringarrptr
  • Loading branch information
zreigz authored Oct 26, 2022
2 parents 10b6c3e + 0d65369 commit f1add17
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions pkg/utils/arrays.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
package utils

func ConvertStringArrayPointer(inputs []*string) []string {
res := make([]string, 0)
if inputs == nil {
return res
return []string{}
}

for _, input := range inputs {
res = append(res, *input)
res := make([]string, len(inputs))
for i, input := range inputs {
res[i] = *input
}
return res
}

func ToStringArrayPtr(input []string) []*string {
if input == nil {
return []*string{}
}

res := make([]*string, len(input))
for i := range input {
res[i] = &input[i]
}
return res
}

0 comments on commit f1add17

Please sign in to comment.