package
0.6.0
Repository: https://github.com/chenmingyong0423/gkit.git
Documentation: pkg.go.dev

# Functions

AddDistinctFunc appends the element of the given slice to the target slice.
AppendDistinct appends elements of a given slice to the target slice, If s or items are nil, both are processed as empty slices.
CombineAndDeduplicateNestedSlices 从任何类型的切片中提取并组合嵌套的切片,然后去重.
CombineAndDeduplicateNestedSlicesByEqFunc 从任何类型的切片中提取并组合嵌套的切片,然后使用自定义的比较函数去重.
CombineNestedSlices 从任何类型的切片中提取并组合嵌套的切片.
Contains checks whether the given slice contains the specified element.
ContainsByFunc checks whether the given slice contains the specified element using the provided equality function.
Deduplicate removes duplicate elements from the given slice and returns a new slice.
DeduplicateByEqFunc function takes a generic slice "data" and an equivalence comparison function "equalFunc[T]", and returns a new slice with duplicate elements removed.
DeleteByFilterFunc is a generic function used to delete elements in a slice of a given type that meet a specific condition.
DeleteByIndex is used to delete a specific index of a given type in a slice.
DeleteByItem is used to delete specified elements in a slice of a given type.
Diff 计算两个切片的差集,该函数只支持 comparable 类型的切片元素 返回的新切片已去重且顺序不确定.
DiffFunc 计算两个切片的差集,由 equal 函数判断两个元素是否相等 返回的新切片已去重.
Filter filters the slice element according to the filter function and returns a new slice.
FilterMap 将给定的切片转换成一个新的切片,其中每个元素都是通过给定的函数 fn 转换得到的。如果 fn 返回的是 bool,则元素将被忽略。.
IndexOf searches for the given target element in the provided slice and return the index of its first occurrence.
IndexOfByFunc looks up the index of the first occurrence of a given target element in the provided slice based on the equality function.
IndexStructsByKey 将给定的结构体切片转换为 map,其中键为结构体的某个字段的值,值为结构体本身.
IntersectionSet 从给定的两个切片中取交集,返回的新切片已去重,该函数只支持 comparable 类型的切片元素.
IntersectionSetFunc 从给定的两个切片中取交集,由 equal 函数判断两个元素是否相等,返回的新切片已去重.
LastIndexOf searches for the given target element in the provided slice, and returns the position index of its last occurrence.
LastIndexOfByFunc finds the index of the last occurrence of the given target element in the provided slice according to the equality function.
Map 将给定的切片转换成一个新的切片,其中每个元素都是通过给定的函数 fn 转换得到的。.
Reverse Reverses the slice.
ReverseInplace Reverses the original slice Parameter: - data: indicates the specified slice ReverseInplace 在原始切片上进行反转 参数: - data:指定的切片.
Union 计算多个切片的并集,该函数只支持 comparable 类型的切片元素.
UnionFunc 计算多个切片的并集,支持任意类型的切片元素 由 equal 参数决定切片元素的相等规则.