The array_utils.go file in the utils package offers a variety of functions to assist with array operations in Go, providing functionality for element removal, existence checks, filtering, and type conversion.
Removes elements from the toRemove array that are not present in the source array.
result := RemoveElementsNotInSource(sourceArray, toRemoveArray)Determines if any element in targetSlice is present in contentSlice.
found := ArrayContainsAny(contentSlice, targetSlice)| Parameter | Type | Description |
|---|---|---|
| contentSlice | []string |
The array to search within. |
| targetSlice | []string |
The array containing target elements to find. |
| return value | bool |
true if any target element is found, otherwise false. |
Filters an array based on a provided condition function.
filtered := FilterArray(array, conditionFunc)The subsequent functions (ConvertToInterfaceArray, ConvertToIntArray, ConvertToUintArray, etc.) follow a similar pattern, converting arrays to different types based on the function's purpose, with their usage and reference details structured similarly to the above examples.
