Documentation ¶
Index ¶
- func All[T comparable](values []T) bool
- func Any[T comparable](values []T) bool
- func Avg[T ...](numbers []T) (avg float64)
- func Chunk[T any](slice []T, chunkSize int) ([][]T, error)
- func Filter[T any](fn func(v T) bool, values []T) (ret []T)
- func FilterDemo()
- func FromAnyArray[T any](anyArray *AnyArray[any]) []T
- func GroupBy[T any](array []T, key string) (map[any][]T, error)
- func In[T comparable](target T, elements []T) bool
- func JoinWithoutEmpty(values []string, sep string) string
- func Max[T ...](values []T) (max T)
- func Min[T ...](values []T) (min T)
- func NotEmptyLen[T comparable](values []T) int
- func Pluck[V any, R any](slice []V, key string) ([]R, error)
- func RemoveEmpty[T comparable](slice []T) []T
- func RemoveTarget[T comparable](values []T, target T) (ret []T)
- func RemoveTargets[T comparable](values []T, targets ...T) (ret []T)
- func Sum[T ...](numbers []T) (sum T)
- func Unique[V any](slice []V) ([]V, error)
- type AnyArray
- func (r *AnyArray[T]) All() []T
- func (r *AnyArray[T]) AllEmpty() bool
- func (r *AnyArray[T]) AnyEmpty() bool
- func (r *AnyArray[T]) Append(v T) *AnyArray[T]
- func (r *AnyArray[T]) Chunk(chunkSize int) [][]T
- func (r *AnyArray[T]) Clean() *AnyArray[T]
- func (r *AnyArray[T]) Copy() *AnyArray[T]
- func (r *AnyArray[T]) Every(fn func(T) T) *AnyArray[T]
- func (r *AnyArray[T]) Filter(fn func(v T) bool) *AnyArray[T]
- func (r *AnyArray[T]) First() T
- func (r *AnyArray[T]) Get(idx int) T
- func (r *AnyArray[T]) GetIndexByValue(value T) int
- func (r *AnyArray[T]) Has(k int) bool
- func (r *AnyArray[T]) In(target T) bool
- func (r *AnyArray[T]) JoinWithoutEmpty(sep string) string
- func (r *AnyArray[T]) Last() T
- func (r *AnyArray[T]) Len() int
- func (r *AnyArray[T]) Pluck(fn func(T) any) *AnyArray[any]
- func (r *AnyArray[T]) RemoveEmpty() *AnyArray[T]
- func (r *AnyArray[T]) RemoveTarget(target T) *AnyArray[T]
- func (r *AnyArray[T]) RemoveTargets(targets ...T) *AnyArray[T]
- func (r *AnyArray[T]) Set(k int, v T) *AnyArray[T]
- func (r *AnyArray[T]) Shuffle() *AnyArray[T]
- func (r *AnyArray[T]) Unique() *AnyArray[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Avg ¶
func Avg[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64](numbers []T) (avg float64)
Avg 计算平均值
func FilterDemo ¶
func FilterDemo()
func JoinWithoutEmpty ¶
JoinWithoutEmpty 去掉空值然后合并
func Max ¶
func Max[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64](values []T) (max T)
Max 判断数组中最大值
func Min ¶
func Min[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64](values []T) (min T)
Min 判断数组中最小值
func RemoveTarget ¶
func RemoveTarget[T comparable](values []T, target T) (ret []T)
RemoveTarget 删除数组中对应的目标
func RemoveTargets ¶
func RemoveTargets[T comparable](values []T, targets ...T) (ret []T)
RemoveTargets 删除数组中对应的多个目标
Types ¶
type AnyArray ¶
type AnyArray[T any] struct { // contains filtered or unexported fields }
func (*AnyArray[T]) GetIndexByValue ¶
GetIndexByValue 根据值获取索引下标
func (*AnyArray[T]) JoinWithoutEmpty ¶
JoinWithoutEmpty 拼接非空元素
func (*AnyArray[T]) RemoveEmpty ¶
RemoveEmpty 清除空值元素
func (*AnyArray[T]) RemoveTarget ¶
RemoveTarget 删除数组中对应的目标
func (*AnyArray[T]) RemoveTargets ¶
RemoveTargets 删除数组中对应的多个目标
Click to show internal directories.
Click to hide internal directories.