Documentation
¶
Index ¶
- func ByLen(s []string)
- func ChunkSlice[SV any](input []SV, chunkSize int) [][]SV
- func Distinct[K comparable](s []K, predicateFunc func(item K) bool) []K
- func Except[K any](s []K, exceptFunc func(item K) bool) []K
- func Filter[SV any](list []SV, filter func(item SV) bool) []SV
- func FindIndex[V any](s []V, equalsFunc func(item V) bool) int
- func In[K comparable](s []K, item K) bool
- func InWithFunc[V any](s []V, equalsFunc func(item V) bool) bool
- func MapFromInterface[DV any](list []interface{}) ([]DV, error)
- func PartitionSlice[SV any](input []SV, partitionCount int) [][]SV
- func RemoveByIndex[V any](slice []V, s int) []V
- func ToInterfaceSlice[T any](list []T) []interface{}
- func ToSliceV[SV any, DV any](list []SV, valueSelectFunc func(item SV) DV) []DV
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChunkSlice ¶
将一个切片分割成指定数量的切片,每个子切片的长度都是chunkSize
func Distinct ¶
func Distinct[K comparable](s []K, predicateFunc func(item K) bool) []K
对一个slice去重,并且将不符合条件的项移除
func InWithFunc ¶
查找slice中是否在切片中,通过传入的回调来进行比较
func MapFromInterface ¶
convert []interface{} to []DV if any array element cannot convert to DV,then return error
func PartitionSlice ¶
将一个切片均匀地分配到多个子切片中,子切片的数量由参数 partitionCount 决定 如果原始切片的长度小于 partitionCount,则每个子切片只包含一个元素
func ToInterfaceSlice ¶
func ToInterfaceSlice[T any](list []T) []interface{}
conver []T to []interface{}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.