Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepCopy ¶
DeepCopy is a function that performs a deep copy of a given value.
Parameters:
- value: The value to copy.
Return:
- any: A deep copy of the input value.
func IsNil ¶ added in v0.2.9
IsNil is a function that checks if a value is nil.
Parameters:
- value: The value to check.
Return:
- bool: True if the value is nil, false otherwise.
func Max ¶ added in v0.2.9
func Max[T Comparable](a, b T) T
Max is a function that takes two parameters, a and b, of any type T that implements the Comparable interface and returns the larger of the two values.
Parameters:
- a, b: The two values to compare.
Return:
- T: The larger of the two values.
func Min ¶ added in v0.2.9
func Min[T Comparable](a, b T) T
Min is a function that takes two parameters, a and b, of any type T that implements the Comparable interface and returns the smaller of the two values.
Parameters:
- a, b: The two values to compare.
Return:
- T: The smaller of the two values.
func SplitIntoGroups ¶
SplitIntoGroups splits the slice into n groups and returns a 2D slice where each inner slice represents a group.
Panics with error of type *ers.ErrInvalidParameter if the number of groups is less than or equal to 0.
Parameters:
- slice: The slice to split.
- n: The number of groups to split the slice into.
Return:
- [][]T: A 2D slice where each inner slice represents a group.
Example:
slice := []int{1, 2, 3, 4, 5} n := 3 groups := SplitIntoGroups(slice, n) fmt.Println(groups) // Output: [[1 4] [2 5] [3]]
Types ¶
type Comparable ¶ added in v0.2.9
type Comparable interface { ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64 | ~string }
Comparable is an interface that defines the behavior of a type that can be compared with other values of the same type using the < and > operators. The interface is implemented by the built-in types int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, and string.