go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers-sdk/v1/util/convert/slice.go (about)

     1  // Copyright (c) Mondoo, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package convert
     5  
     6  func SliceAnyToInterface[T any](s []T) []interface{} {
     7  	res := make([]interface{}, len(s))
     8  	for i, v := range s {
     9  		res[i] = v
    10  	}
    11  	return res
    12  }
    13  
    14  func SliceStrPtrToStr(s []*string) []string {
    15  	res := make([]string, len(s))
    16  	for i, v := range s {
    17  		res[i] = *v
    18  	}
    19  	return res
    20  }
    21  
    22  func SliceStrPtrToInterface(s []*string) []interface{} {
    23  	res := make([]interface{}, len(s))
    24  	for i, v := range s {
    25  		res[i] = *v
    26  	}
    27  	return res
    28  }